feat(batch1): add mapped proto scan helpers with boundary tests
This commit is contained in:
@@ -51,6 +51,12 @@ public static class ProtoWire
|
||||
return (num, typ, sizeTag + sizeValue, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compatibility mapped entrypoint for PortTracker: <c>protoScanField</c>.
|
||||
/// </summary>
|
||||
public static (int num, int typ, int size, Exception? err) ProtoScanField(ReadOnlySpan<byte> b)
|
||||
=> ScanField(b);
|
||||
|
||||
/// <summary>
|
||||
/// Reads a protobuf tag varint and returns field number, wire type, and bytes consumed.
|
||||
/// Mirrors <c>protoScanTag</c>.
|
||||
@@ -71,6 +77,12 @@ public static class ProtoWire
|
||||
return (num, typ, size, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compatibility mapped entrypoint for PortTracker: <c>protoScanTag</c>.
|
||||
/// </summary>
|
||||
public static (int num, int typ, int size, Exception? err) ProtoScanTag(ReadOnlySpan<byte> b)
|
||||
=> ScanTag(b);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the byte count consumed by a field value with the given wire type.
|
||||
/// Mirrors <c>protoScanFieldValue</c>.
|
||||
@@ -98,6 +110,12 @@ public static class ProtoWire
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compatibility mapped entrypoint for PortTracker: <c>protoScanFieldValue</c>.
|
||||
/// </summary>
|
||||
public static (int size, Exception? err) ProtoScanFieldValue(int typ, ReadOnlySpan<byte> b)
|
||||
=> ScanFieldValue(typ, b);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Varint decode
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -170,6 +188,12 @@ public static class ProtoWire
|
||||
return (0, 0, ErrOverflow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compatibility mapped entrypoint for PortTracker: <c>protoScanVarint</c>.
|
||||
/// </summary>
|
||||
public static (ulong v, int size, Exception? err) ProtoScanVarint(ReadOnlySpan<byte> b)
|
||||
=> ScanVarint(b);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Length-delimited decode
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -190,6 +214,12 @@ public static class ProtoWire
|
||||
return (lenSize + (int)l, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compatibility mapped entrypoint for PortTracker: <c>protoScanBytes</c>.
|
||||
/// </summary>
|
||||
public static (int size, Exception? err) ProtoScanBytes(ReadOnlySpan<byte> b)
|
||||
=> ScanBytes(b);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Varint encode
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user