pub struct Leb128Codec<T, P> { /* private fields */ }Expand description
Type-level unchecked LEB128 codec.
Encoding is always canonical; P only affects decoding. Encoding-only
callers should conventionally use crate::NonStrict because no decoding
policy is applied on that path.
§Type Parameters
T: Integer value type to decode from LEB128 bytes and encode into canonical LEB128 bytes.P: Required type-level decoding policy implementingLeb128DecodePolicy. Usecrate::Strictto reject non-canonical inputs, orcrate::NonStrictto accept non-canonical inputs. This parameter does not affect canonical encoding.
The decoding policy is intentionally required so wire-format callers make the canonicality contract explicit.
use qubit_codec_binary::Leb128Codec;
let _ = Leb128Codec::<u64>::default();§Examples
use qubit_codec_binary::{
Leb128Codec,
NonStrict,
};
let mut output = [0_u8; Leb128Codec::<u64, NonStrict>::MAX_ENCODE_UNITS_PER_VALUE];
let written = unsafe {
Leb128Codec::<u64, NonStrict>::encode(300, &mut output, 0)
};
assert_eq!(2, written);
let (decoded, consumed) = unsafe {
Leb128Codec::<u64, NonStrict>::decode(&output[..written], 0)
}.expect("canonical LEB128 value should decode");
assert_eq!(300, decoded);
assert_eq!(2, consumed.get());Implementations§
Source§impl<P> Leb128Codec<u8, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<u8, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(u8, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(u8, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without
bounds checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(value: u8, output: &mut [u8], output_index: usize) -> usize
pub unsafe fn encode(value: u8, output: &mut [u8], output_index: usize) -> usize
Encodes value into output starting at output_index without
bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical unsigned LEB128
byte width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<u16, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<u16, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(u16, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(u16, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without
bounds checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: u16,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: u16, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without
bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical unsigned LEB128
byte width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<u32, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<u32, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(u32, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(u32, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without
bounds checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: u32,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: u32, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without
bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical unsigned LEB128
byte width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<u64, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<u64, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(u64, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(u64, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without
bounds checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: u64,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: u64, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without
bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical unsigned LEB128
byte width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<u128, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<u128, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(u128, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(u128, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without
bounds checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: u128,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: u128, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without
bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical unsigned LEB128
byte width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<usize, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<usize, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(usize, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(usize, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without
bounds checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: usize,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: usize, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without
bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical unsigned LEB128
byte width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<i8, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<i8, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(i8, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(i8, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without bounds
checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(value: i8, output: &mut [u8], output_index: usize) -> usize
pub unsafe fn encode(value: i8, output: &mut [u8], output_index: usize) -> usize
Encodes value into output starting at output_index without bounds
checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical signed LEB128 byte
width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<i16, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<i16, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(i16, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(i16, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without bounds
checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: i16,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: i16, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without bounds
checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical signed LEB128 byte
width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<i32, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<i32, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(i32, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(i32, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without bounds
checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: i32,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: i32, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without bounds
checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical signed LEB128 byte
width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<i64, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<i64, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(i64, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(i64, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without bounds
checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: i64,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: i64, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without bounds
checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical signed LEB128 byte
width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<i128, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<i128, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(i128, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(i128, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without bounds
checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: i128,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: i128, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without bounds
checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical signed LEB128 byte
width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Source§impl<P> Leb128Codec<isize, P>where
P: Leb128DecodePolicy,
impl<P> Leb128Codec<isize, P>where
P: Leb128DecodePolicy,
Sourcepub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
pub const MIN_UNITS_PER_VALUE: usize = <Self as Codec>::MIN_UNITS_PER_VALUE
Minimum number of bytes that can represent a complete value.
Sourcepub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
pub const MAX_ENCODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_ENCODE_UNITS_PER_VALUE
Maximum number of bytes emitted when encoding this type.
Sourcepub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
pub const MAX_DECODE_UNITS_PER_VALUE: usize = <Self as Codec>::MAX_DECODE_UNITS_PER_VALUE
Maximum number of bytes consumed when decoding this type.
Sourcepub unsafe fn decode(
input: &[u8],
input_index: usize,
) -> Result<(isize, NonZeroUsize), Leb128DecodeError>
pub unsafe fn decode( input: &[u8], input_index: usize, ) -> Result<(isize, NonZeroUsize), Leb128DecodeError>
Decodes a value from input starting at input_index without bounds
checks.
§Parameters
input: Source byte buffer.input_index: Start index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Errors
Returns Leb128DecodeError if the bytes are incomplete,
malformed, or strict decoding rejects a non-canonical
representation.
§Safety
The caller must guarantee that input_index is a valid boundary
and at least Self::MIN_UNITS_PER_VALUE byte is readable
from input_index.
Sourcepub unsafe fn encode(
value: isize,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: isize, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index without bounds
checks.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start index inoutput.
§Returns
Returns the number of written bytes.
§Safety
The caller must guarantee that the canonical signed LEB128 byte
width of value is writable starting at output_index.
Reserving Self::MAX_ENCODE_UNITS_PER_VALUE bytes always satisfies
this requirement; for a known value, the exact
Codec::encode_len is sufficient.
Trait Implementations§
Source§impl<P> Codec for Leb128Codec<u8, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<u8, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &u8) -> usize
fn encode_len(&self, value: &u8) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(u8, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(u8, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &u8,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &u8, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<u16, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<u16, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &u16) -> usize
fn encode_len(&self, value: &u16) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(u16, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(u16, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &u16,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &u16, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<u32, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<u32, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &u32) -> usize
fn encode_len(&self, value: &u32) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(u32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(u32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &u32,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &u32, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<u64, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<u64, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &u64) -> usize
fn encode_len(&self, value: &u64) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(u64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(u64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &u64,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &u64, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<u128, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<u128, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &u128) -> usize
fn encode_len(&self, value: &u128) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(u128, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(u128, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &u128,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &u128, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<usize, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<usize, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &usize) -> usize
fn encode_len(&self, value: &usize) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(usize, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(usize, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &usize,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &usize, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<i8, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<i8, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &i8) -> usize
fn encode_len(&self, value: &i8) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(i8, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(i8, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &i8,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &i8, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<i16, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<i16, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &i16) -> usize
fn encode_len(&self, value: &i16) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(i16, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(i16, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &i16,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &i16, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<i32, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<i32, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &i32) -> usize
fn encode_len(&self, value: &i32) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(i32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(i32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &i32,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &i32, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<i64, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<i64, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &i64) -> usize
fn encode_len(&self, value: &i64) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(i64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(i64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &i64,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &i64, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<i128, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<i128, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &i128) -> usize
fn encode_len(&self, value: &i128) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(i128, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(i128, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &i128,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &i128, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read moreSource§impl<P> Codec for Leb128Codec<isize, P>where
P: Leb128DecodePolicy,
impl<P> Codec for Leb128Codec<isize, P>where
P: Leb128DecodePolicy,
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize
const MAX_ENCODE_UNITS_PER_VALUE: usize
Source§const MAX_DECODE_UNITS_PER_VALUE: usize
const MAX_DECODE_UNITS_PER_VALUE: usize
Source§type DecodeError = Leb128DecodeError
type DecodeError = Leb128DecodeError
Source§type EncodeError = !
type EncodeError = !
Source§fn encode_len(&self, value: &isize) -> usize
fn encode_len(&self, value: &isize) -> usize
value. Read moreSource§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(isize, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(isize, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Source§unsafe fn encode(
&mut self,
value: &isize,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &isize, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
value is in this codec’s encodable value domain. Read moreSource§unsafe fn encode_reset(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_reset( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn encode_finish(
&mut self,
_output: &mut [Self::Unit],
_output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_finish( &mut self, _output: &mut [Self::Unit], _output_index: usize, ) -> Result<usize, Self::EncodeError>
Source§unsafe fn decode_reset(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_reset( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
Source§unsafe fn decode_eof(
&mut self,
input: &[Self::Unit],
input_index: usize,
) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
unsafe fn decode_eof( &mut self, input: &[Self::Unit], input_index: usize, ) -> Result<(Self::Value, NonZero<usize>), DecodeFailure<Self::DecodeError>>
Source§unsafe fn decode_finish(
&mut self,
_output: &mut [Self::Value],
_output_index: usize,
) -> Result<usize, Self::DecodeError>
unsafe fn decode_finish( &mut self, _output: &mut [Self::Value], _output_index: usize, ) -> Result<usize, Self::DecodeError>
output. Read more