Explorar o código

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

This is simply a thin wrapper around the already existing
KString::formatted() API.
Idan Horowitz %!s(int64=3) %!d(string=hai) anos
pai
achega
aa1f7060af
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  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;