소스 검색

Kernel: Add an error propagating KString::number() API

This is simply a thin wrapper around the already existing
KString::formatted() API.
Idan Horowitz 3 년 전
부모
커밋
aa1f7060af
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      Kernel/KString.h

+ 5 - 0
Kernel/KString.h

@@ -30,6 +30,11 @@ public:
         return vformatted(fmtstr.view(), variadic_format_parameters);
     }
 
+    [[nodiscard]] static ErrorOr<NonnullOwnPtr<KString>> number(Arithmetic auto value)
+    {
+        return formatted("{}", value);
+    }
+
     void operator delete(void*);
 
     ErrorOr<NonnullOwnPtr<KString>> try_clone() const;