pub struct BinaryCodec<T, O> { /* private fields */ }Expand description
Type-level unchecked binary codec for one scalar type and one byte order.
BinaryCodec is intentionally a zero-sized codec type. It exposes
type-level unchecked helpers for direct hot-path use and also implements
Codec for generic codec pipelines. Callers must validate buffer lengths
before entering the hot path.
§Type Parameters
T: Scalar value type to decode from bytes and encode into bytes.O: Type-level byte order marker. Multi-byte scalar implementations useBigEndian,LittleEndian, orNativeEndian. Prefer big- or little-endian formats for persistent and cross-platform data; native-endian encoding is only suitable for platform-local data. Single- byte scalar implementations accept anyByteOrderSpecmarker because byte order does not affect one-byte values.
§Examples
use qubit_codec::BigEndian;
use qubit_codec_binary::BinaryCodec;
let mut output = [0_u8; BinaryCodec::<u32, BigEndian>::MAX_ENCODE_UNITS_PER_VALUE];
let written = unsafe {
BinaryCodec::<u32, BigEndian>::encode(0x0102_0304, &mut output, 0)
};
assert_eq!(4, written);
assert_eq!([1, 2, 3, 4], output);
let (decoded, consumed) = unsafe {
BinaryCodec::<u32, BigEndian>::decode(&output, 0)
};
assert_eq!(0x0102_0304, decoded);
assert_eq!(4, consumed.get());Byte-order markers are also required for single-byte codecs, even though the marker has no effect on the encoded bytes:
use qubit_codec_binary::{BinaryCodec, Strict};
let mut output = [0_u8; 1];
let _ = unsafe { BinaryCodec::<u8, Strict>::encode(1, &mut output, 0) };Implementations§
Source§impl<O> BinaryCodec<u8, O>where
O: ByteOrderSpec,
impl<O> BinaryCodec<u8, O>where
O: ByteOrderSpec,
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 required to encode or decode this type.
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) -> (u8, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u8, NonZeroUsize)
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.
§Safety
The caller must guarantee that input.as_ptr().add(input_index) is
valid to read Self::MIN_UNITS_PER_VALUE bytes.
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 bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that output.as_mut_ptr().add(output_index)
is valid to write Self::MAX_ENCODE_UNITS_PER_VALUE bytes.
Source§impl<O> BinaryCodec<i8, O>where
O: ByteOrderSpec,
impl<O> BinaryCodec<i8, O>where
O: ByteOrderSpec,
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 required to encode or decode this type.
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) -> (i8, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i8, NonZeroUsize)
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.
§Safety
The caller must guarantee that input.as_ptr().add(input_index) is
valid to read Self::MIN_UNITS_PER_VALUE bytes.
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 bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that output.as_mut_ptr().add(output_index)
is valid to write Self::MAX_ENCODE_UNITS_PER_VALUE bytes.
Source§impl BinaryCodec<u16, BigEndian>
impl BinaryCodec<u16, BigEndian>
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 required to encode or decode this type.
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) -> (u16, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u16, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u16, LittleEndian>
impl BinaryCodec<u16, LittleEndian>
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 required to encode or decode this type.
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) -> (u16, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u16, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u32, BigEndian>
impl BinaryCodec<u32, BigEndian>
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 required to encode or decode this type.
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) -> (u32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u32, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u32, LittleEndian>
impl BinaryCodec<u32, LittleEndian>
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 required to encode or decode this type.
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) -> (u32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u32, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u64, BigEndian>
impl BinaryCodec<u64, BigEndian>
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 required to encode or decode this type.
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) -> (u64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u64, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u64, LittleEndian>
impl BinaryCodec<u64, LittleEndian>
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 required to encode or decode this type.
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) -> (u64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u64, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u128, BigEndian>
impl BinaryCodec<u128, BigEndian>
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 required to encode or decode this type.
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) -> (u128, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u128, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u128, LittleEndian>
impl BinaryCodec<u128, LittleEndian>
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 required to encode or decode this type.
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) -> (u128, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u128, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i16, BigEndian>
impl BinaryCodec<i16, BigEndian>
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 required to encode or decode this type.
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) -> (i16, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i16, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i16, LittleEndian>
impl BinaryCodec<i16, LittleEndian>
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 required to encode or decode this type.
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) -> (i16, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i16, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i32, BigEndian>
impl BinaryCodec<i32, BigEndian>
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 required to encode or decode this type.
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) -> (i32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i32, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i32, LittleEndian>
impl BinaryCodec<i32, LittleEndian>
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 required to encode or decode this type.
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) -> (i32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i32, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i64, BigEndian>
impl BinaryCodec<i64, BigEndian>
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 required to encode or decode this type.
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) -> (i64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i64, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i64, LittleEndian>
impl BinaryCodec<i64, LittleEndian>
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 required to encode or decode this type.
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) -> (i64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i64, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i128, BigEndian>
impl BinaryCodec<i128, BigEndian>
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 required to encode or decode this type.
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) -> (i128, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i128, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i128, LittleEndian>
impl BinaryCodec<i128, LittleEndian>
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 required to encode or decode this type.
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) -> (i128, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i128, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
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.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f32, BigEndian>
impl BinaryCodec<f32, BigEndian>
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 required to encode or decode this type.
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) -> (f32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (f32, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded floating-point value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode(
value: f32,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: f32, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index
without bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Floating-point value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f32, LittleEndian>
impl BinaryCodec<f32, LittleEndian>
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 required to encode or decode this type.
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) -> (f32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (f32, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded floating-point value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode(
value: f32,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: f32, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index
without bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Floating-point value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f64, BigEndian>
impl BinaryCodec<f64, BigEndian>
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 required to encode or decode this type.
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) -> (f64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (f64, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded floating-point value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode(
value: f64,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: f64, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index
without bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Floating-point value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f64, LittleEndian>
impl BinaryCodec<f64, LittleEndian>
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 required to encode or decode this type.
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) -> (f64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (f64, NonZeroUsize)
Decodes a value from input starting at input_index without
bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
input: Source byte buffer.input_index: Start byte index ininput.
§Returns
Returns the decoded floating-point value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
input_index + Self::MIN_UNITS_PER_VALUE <= input.len()input[input_index..input_index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode(
value: f64,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: f64, output: &mut [u8], output_index: usize, ) -> usize
Encodes value into output starting at output_index
without bounds checks.
This function is intended for hot binary codec paths where the caller has already validated the buffer length externally.
§Parameters
value: Floating-point value to encode.output: Destination byte buffer.output_index: Start byte index inoutput.
§Returns
Returns the number of bytes written, equal to
Self::MAX_ENCODE_UNITS_PER_VALUE, independently of output_index.
The next output position is output_index + written, where written
is the returned byte count.
§Safety
The caller must guarantee that:
output_index + Self::MAX_ENCODE_UNITS_PER_VALUE <= output.len()output[output_index..output_index + Self::MAX_ENCODE_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u16, NativeEndian>
impl BinaryCodec<u16, NativeEndian>
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 required to encode or decode this type.
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) -> (u16, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u16, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<u32, NativeEndian>
impl BinaryCodec<u32, NativeEndian>
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 required to encode or decode this type.
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) -> (u32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u32, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<u64, NativeEndian>
impl BinaryCodec<u64, NativeEndian>
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 required to encode or decode this type.
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) -> (u64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u64, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<u128, NativeEndian>
impl BinaryCodec<u128, NativeEndian>
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 required to encode or decode this type.
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) -> (u128, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (u128, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<i16, NativeEndian>
impl BinaryCodec<i16, NativeEndian>
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 required to encode or decode this type.
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) -> (i16, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i16, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<i32, NativeEndian>
impl BinaryCodec<i32, NativeEndian>
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 required to encode or decode this type.
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) -> (i32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i32, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<i64, NativeEndian>
impl BinaryCodec<i64, NativeEndian>
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 required to encode or decode this type.
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) -> (i64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i64, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<i128, NativeEndian>
impl BinaryCodec<i128, NativeEndian>
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 required to encode or decode this type.
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) -> (i128, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (i128, NonZeroUsize)
Decodes a native-endian value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded value and the fixed number of bytes read.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
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 a native-endian value without bounds checks.
§Parameters
value: Value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<f32, NativeEndian>
impl BinaryCodec<f32, NativeEndian>
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 required to encode or decode this type.
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) -> (f32, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (f32, NonZeroUsize)
Decodes a native-endian floating-point value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded floating-point value and fixed byte count.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
Sourcepub unsafe fn encode(
value: f32,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: f32, output: &mut [u8], output_index: usize, ) -> usize
Encodes a native-endian floating-point value without bounds checks.
§Parameters
value: Floating-point value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Source§impl BinaryCodec<f64, NativeEndian>
impl BinaryCodec<f64, NativeEndian>
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 required to encode or decode this type.
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) -> (f64, NonZeroUsize)
pub unsafe fn decode(input: &[u8], input_index: usize) -> (f64, NonZeroUsize)
Decodes a native-endian floating-point value without bounds checks.
§Parameters
input: Byte slice containing the encoded value.input_index: Absolute byte index where decoding starts.
§Returns
Returns the decoded floating-point value and fixed byte count.
§Safety
The caller must guarantee that at least
Self::MIN_UNITS_PER_VALUE bytes are readable from input_index
within input.
Sourcepub unsafe fn encode(
value: f64,
output: &mut [u8],
output_index: usize,
) -> usize
pub unsafe fn encode( value: f64, output: &mut [u8], output_index: usize, ) -> usize
Encodes a native-endian floating-point value without bounds checks.
§Parameters
value: Floating-point value to encode.output: Destination byte slice.output_index: Absolute byte index where encoding starts.
§Returns
Returns the fixed number of bytes written.
§Safety
The caller must guarantee that at least
Self::MAX_ENCODE_UNITS_PER_VALUE bytes are writable from
output_index within output.
Trait Implementations§
Source§impl<O> Codec for BinaryCodec<u8, O>where
O: ByteOrderSpec,
impl<O> Codec for BinaryCodec<u8, O>where
O: ByteOrderSpec,
Source§type DecodeError = !
type DecodeError = !
Decoding a byte cannot fail after the caller satisfies the safety contract.
Source§type EncodeError = !
type EncodeError = !
Encoding a byte cannot fail after the caller satisfies the safety contract.
Source§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>>
Decodes one byte from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index of the byte to decode.
§Returns
Returns the decoded byte and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions; the input must contain the byte at input_index.
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>
Encodes one byte into the supplied output slice.
§Parameters
value: Byte value to encode.output: Destination byte buffer.output_index: Index where the encoded byte is written.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions; the output must have space at output_index.
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 1
const MAX_ENCODE_UNITS_PER_VALUE: usize = 1
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 1
const MAX_DECODE_UNITS_PER_VALUE: usize = 1
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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<O> Codec for BinaryCodec<i8, O>where
O: ByteOrderSpec,
impl<O> Codec for BinaryCodec<i8, O>where
O: ByteOrderSpec,
Source§type DecodeError = !
type DecodeError = !
Decoding a byte cannot fail after the caller satisfies the safety contract.
Source§type EncodeError = !
type EncodeError = !
Encoding a byte cannot fail after the caller satisfies the safety contract.
Source§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>>
Decodes one signed byte from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index of the byte to decode.
§Returns
Returns the decoded signed byte and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions; the input must contain the byte at input_index.
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>
Encodes one signed byte into the supplied output slice.
§Parameters
value: Signed byte value to encode.output: Destination byte buffer.output_index: Index where the encoded byte is written.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions; the output must have space at output_index.
Source§const MIN_UNITS_PER_VALUE: usize = 1
const MIN_UNITS_PER_VALUE: usize = 1
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 1
const MAX_ENCODE_UNITS_PER_VALUE: usize = 1
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 1
const MAX_DECODE_UNITS_PER_VALUE: usize = 1
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u16, BigEndian>
impl Codec for BinaryCodec<u16, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 2
const MIN_UNITS_PER_VALUE: usize = 2
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 2
const MAX_DECODE_UNITS_PER_VALUE: usize = 2
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u16, LittleEndian>
impl Codec for BinaryCodec<u16, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 2
const MIN_UNITS_PER_VALUE: usize = 2
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 2
const MAX_DECODE_UNITS_PER_VALUE: usize = 2
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u32, BigEndian>
impl Codec for BinaryCodec<u32, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u32, LittleEndian>
impl Codec for BinaryCodec<u32, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u64, BigEndian>
impl Codec for BinaryCodec<u64, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u64, LittleEndian>
impl Codec for BinaryCodec<u64, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u128, BigEndian>
impl Codec for BinaryCodec<u128, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 16
const MIN_UNITS_PER_VALUE: usize = 16
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 16
const MAX_DECODE_UNITS_PER_VALUE: usize = 16
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u128, LittleEndian>
impl Codec for BinaryCodec<u128, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 16
const MIN_UNITS_PER_VALUE: usize = 16
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 16
const MAX_DECODE_UNITS_PER_VALUE: usize = 16
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i16, BigEndian>
impl Codec for BinaryCodec<i16, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 2
const MIN_UNITS_PER_VALUE: usize = 2
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 2
const MAX_DECODE_UNITS_PER_VALUE: usize = 2
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i16, LittleEndian>
impl Codec for BinaryCodec<i16, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 2
const MIN_UNITS_PER_VALUE: usize = 2
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 2
const MAX_DECODE_UNITS_PER_VALUE: usize = 2
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i32, BigEndian>
impl Codec for BinaryCodec<i32, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i32, LittleEndian>
impl Codec for BinaryCodec<i32, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i64, BigEndian>
impl Codec for BinaryCodec<i64, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i64, LittleEndian>
impl Codec for BinaryCodec<i64, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i128, BigEndian>
impl Codec for BinaryCodec<i128, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 16
const MIN_UNITS_PER_VALUE: usize = 16
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 16
const MAX_DECODE_UNITS_PER_VALUE: usize = 16
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i128, LittleEndian>
impl Codec for BinaryCodec<i128, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 16
const MIN_UNITS_PER_VALUE: usize = 16
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 16
const MAX_DECODE_UNITS_PER_VALUE: usize = 16
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<f32, BigEndian>
impl Codec for BinaryCodec<f32, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(f32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(f32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§unsafe fn encode(
&mut self,
value: &f32,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &f32, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<f32, LittleEndian>
impl Codec for BinaryCodec<f32, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(f32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(f32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§unsafe fn encode(
&mut self,
value: &f32,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &f32, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<f64, BigEndian>
impl Codec for BinaryCodec<f64, BigEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(f64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(f64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§unsafe fn encode(
&mut self,
value: &f64,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &f64, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<f64, LittleEndian>
impl Codec for BinaryCodec<f64, LittleEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(f64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(f64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§unsafe fn encode(
&mut self,
value: &f64,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &f64, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u16, NativeEndian>
impl Codec for BinaryCodec<u16, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 2
const MIN_UNITS_PER_VALUE: usize = 2
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 2
const MAX_DECODE_UNITS_PER_VALUE: usize = 2
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u32, NativeEndian>
impl Codec for BinaryCodec<u32, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u64, NativeEndian>
impl Codec for BinaryCodec<u64, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<u128, NativeEndian>
impl Codec for BinaryCodec<u128, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 16
const MIN_UNITS_PER_VALUE: usize = 16
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 16
const MAX_DECODE_UNITS_PER_VALUE: usize = 16
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i16, NativeEndian>
impl Codec for BinaryCodec<i16, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 2
const MIN_UNITS_PER_VALUE: usize = 2
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
const MAX_ENCODE_UNITS_PER_VALUE: usize = 2
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 2
const MAX_DECODE_UNITS_PER_VALUE: usize = 2
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i32, NativeEndian>
impl Codec for BinaryCodec<i32, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i64, NativeEndian>
impl Codec for BinaryCodec<i64, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<i128, NativeEndian>
impl Codec for BinaryCodec<i128, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§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>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
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>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 16
const MIN_UNITS_PER_VALUE: usize = 16
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
const MAX_ENCODE_UNITS_PER_VALUE: usize = 16
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 16
const MAX_DECODE_UNITS_PER_VALUE: usize = 16
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<f32, NativeEndian>
impl Codec for BinaryCodec<f32, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(f32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(f32, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§unsafe fn encode(
&mut self,
value: &f32,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &f32, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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 Codec for BinaryCodec<f64, NativeEndian>
impl Codec for BinaryCodec<f64, NativeEndian>
Source§type DecodeError = !
type DecodeError = !
Decoding cannot fail after the buffer preconditions are met.
Source§type EncodeError = !
type EncodeError = !
Encoding cannot fail after the buffer preconditions are met.
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<(f64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<(f64, NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one scalar value from the supplied input slice.
§Parameters
input: Source byte buffer.input_index: Index where decoding starts.
§Returns
Returns the decoded scalar and the number of bytes consumed.
§Safety
The caller must satisfy the Codec::decode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§unsafe fn encode(
&mut self,
value: &f64,
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &f64, output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one scalar value into the supplied output slice.
§Parameters
value: Scalar value to encode.output: Destination byte buffer.output_index: Index where encoding starts.
§Returns
Returns the number of bytes written.
§Safety
The caller must satisfy the Codec::encode buffer and index
preconditions for this scalar’s fixed encoded width.
Source§const MIN_UNITS_PER_VALUE: usize = 8
const MIN_UNITS_PER_VALUE: usize = 8
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
const MAX_ENCODE_UNITS_PER_VALUE: usize = 8
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 8
const MAX_DECODE_UNITS_PER_VALUE: usize = 8
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§fn encode_len(&self, _value: &Self::Value) -> usize
fn encode_len(&self, _value: &Self::Value) -> usize
value. 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