aboutsummaryrefslogtreecommitdiff
path: root/lib/Utils/src/ERRNO.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-21 21:43:21 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-21 21:43:21 -0500
commit05ebe3b38342ba38ad0f1c418058d5100ca776ab (patch)
tree42d8b368c7dabc09d8761f3cce7411c8f5b0565f /lib/Utils/src/ERRNO.cs
parent46caaac9debdaad496c07af9d3806e67a447066c (diff)
Fix FBM session cancel, fix plugin log file names
Diffstat (limited to 'lib/Utils/src/ERRNO.cs')
-rw-r--r--lib/Utils/src/ERRNO.cs25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/Utils/src/ERRNO.cs b/lib/Utils/src/ERRNO.cs
index 972aa49..03ebd17 100644
--- a/lib/Utils/src/ERRNO.cs
+++ b/lib/Utils/src/ERRNO.cs
@@ -124,14 +124,36 @@ namespace VNLib.Utils
public readonly override int GetHashCode() => ErrorCode.GetHashCode();
/// <summary>
+ /// Attempts to parse the value of the character sequence as a new error code
+ /// </summary>
+ /// <param name="value">The character sequence value to parse</param>
+ /// <param name="result">The value </param>
+ /// <returns>True if the value was successfully parsed, false othwerwise</returns>
+ public static bool TryParse(ReadOnlySpan<char> value, out ERRNO result)
+ {
+ result = 0;
+ if (nint.TryParse(value, out nint res))
+ {
+ result = new ERRNO(res);
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
/// The integer error value of the current instance in radix 10
/// </summary>
- /// <returns></returns>
+ /// <returns>The radix 10 formatted error code</returns>
public readonly override string ToString()
{
//Return the string of the error code number
return ErrorCode.ToString();
}
+ /// <summary>
+ /// Formats the internal nint error code as a string in specified format
+ /// </summary>
+ /// <param name="format">The format to use</param>
+ /// <returns>The formatted error code</returns>
public readonly string ToString(string format)
{
//Return the string of the error code number
@@ -143,6 +165,7 @@ namespace VNLib.Utils
{
return ErrorCode.TryFormat(destination, out charsWritten, format, provider);
}
+
///<inheritdoc/>
public readonly string ToString(string format, IFormatProvider formatProvider)
{