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 useBigEndianorLittleEndian. Single-byte scalar implementations accept any marker because byte order does not affect one-byte values.
§Examples
use qubit_codec_binary::{
BigEndian,
BinaryCodec,
};
let mut output = [0_u8; BinaryCodec::<u32, BigEndian>::MAX_UNITS_PER_VALUE];
let written = unsafe {
BinaryCodec::<u32, BigEndian>::encode_unchecked(0x0102_0304, &mut output, 0)
};
assert_eq!(4, written);
assert_eq!([1, 2, 3, 4], output);
let (decoded, consumed) = unsafe {
BinaryCodec::<u32, BigEndian>::decode_unchecked(&output, 0)
};
assert_eq!(0x0102_0304, decoded);
assert_eq!(4, consumed.get());Implementations§
Source§impl<O> BinaryCodec<u8, O>
impl<O> BinaryCodec<u8, O>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 1
pub const MIN_UNITS_PER_VALUE: usize = 1
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(input: &[u8], index: usize) -> (u8, NonZeroUsize)
pub unsafe fn decode_unchecked(input: &[u8], index: usize) -> (u8, NonZeroUsize)
Decodes a value from input starting at index without bounds checks.
§Parameters
input: Source byte buffer.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(index) is valid to
read Self::MIN_UNITS_PER_VALUE bytes.
Sourcepub unsafe fn encode_unchecked(
value: u8,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u8, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at index without bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.index: Start index inoutput.
§Safety
The caller must guarantee that output.as_mut_ptr().add(index) is valid
to write Self::MAX_UNITS_PER_VALUE bytes.
Source§impl<O> BinaryCodec<i8, O>
impl<O> BinaryCodec<i8, O>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 1
pub const MIN_UNITS_PER_VALUE: usize = 1
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(input: &[u8], index: usize) -> (i8, NonZeroUsize)
pub unsafe fn decode_unchecked(input: &[u8], index: usize) -> (i8, NonZeroUsize)
Decodes a value from input starting at index without bounds checks.
§Parameters
input: Source byte buffer.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(index) is valid to
read Self::MIN_UNITS_PER_VALUE bytes.
Sourcepub unsafe fn encode_unchecked(
value: i8,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i8, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at index without bounds checks.
§Parameters
value: Value to encode.output: Destination byte buffer.index: Start index inoutput.
§Safety
The caller must guarantee that output.as_mut_ptr().add(index) is valid
to write Self::MAX_UNITS_PER_VALUE bytes.
Source§impl BinaryCodec<u16, BigEndian>
impl BinaryCodec<u16, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 2
pub const MIN_UNITS_PER_VALUE: usize = 2
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u16, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u16, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u16,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u16, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u16, LittleEndian>
impl BinaryCodec<u16, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 2
pub const MIN_UNITS_PER_VALUE: usize = 2
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u16, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u16, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u16,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u16, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u32, BigEndian>
impl BinaryCodec<u32, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 4
pub const MIN_UNITS_PER_VALUE: usize = 4
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u32, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u32, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u32,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u32, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u32, LittleEndian>
impl BinaryCodec<u32, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 4
pub const MIN_UNITS_PER_VALUE: usize = 4
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u32, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u32, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u32,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u32, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u64, BigEndian>
impl BinaryCodec<u64, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 8
pub const MIN_UNITS_PER_VALUE: usize = 8
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u64, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u64, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u64,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u64, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u64, LittleEndian>
impl BinaryCodec<u64, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 8
pub const MIN_UNITS_PER_VALUE: usize = 8
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u64, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u64, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u64,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u64, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u128, BigEndian>
impl BinaryCodec<u128, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 16
pub const MIN_UNITS_PER_VALUE: usize = 16
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u128, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u128, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u128,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u128, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<u128, LittleEndian>
impl BinaryCodec<u128, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 16
pub const MIN_UNITS_PER_VALUE: usize = 16
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (u128, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (u128, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: u128,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: u128, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i16, BigEndian>
impl BinaryCodec<i16, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 2
pub const MIN_UNITS_PER_VALUE: usize = 2
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i16, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i16, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i16,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i16, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i16, LittleEndian>
impl BinaryCodec<i16, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 2
pub const MIN_UNITS_PER_VALUE: usize = 2
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i16, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i16, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i16,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i16, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i32, BigEndian>
impl BinaryCodec<i32, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 4
pub const MIN_UNITS_PER_VALUE: usize = 4
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i32, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i32, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i32,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i32, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i32, LittleEndian>
impl BinaryCodec<i32, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 4
pub const MIN_UNITS_PER_VALUE: usize = 4
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i32, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i32, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i32,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i32, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i64, BigEndian>
impl BinaryCodec<i64, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 8
pub const MIN_UNITS_PER_VALUE: usize = 8
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i64, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i64, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i64,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i64, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i64, LittleEndian>
impl BinaryCodec<i64, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 8
pub const MIN_UNITS_PER_VALUE: usize = 8
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i64, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i64, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i64,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i64, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i128, BigEndian>
impl BinaryCodec<i128, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 16
pub const MIN_UNITS_PER_VALUE: usize = 16
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i128, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i128, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i128,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i128, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<i128, LittleEndian>
impl BinaryCodec<i128, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 16
pub const MIN_UNITS_PER_VALUE: usize = 16
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (i128, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (i128, NonZeroUsize)
Decodes a value from input starting at 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.index: Start byte index ininput.
§Returns
Returns the decoded value and the non-zero number of consumed bytes.
§Safety
The caller must guarantee that:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: i128,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: i128, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f32, BigEndian>
impl BinaryCodec<f32, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 4
pub const MIN_UNITS_PER_VALUE: usize = 4
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (f32, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (f32, NonZeroUsize)
Decodes a value from input starting at 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.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:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: f32,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: f32, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f32, LittleEndian>
impl BinaryCodec<f32, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 4
pub const MIN_UNITS_PER_VALUE: usize = 4
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (f32, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (f32, NonZeroUsize)
Decodes a value from input starting at 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.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:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: f32,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: f32, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f64, BigEndian>
impl BinaryCodec<f64, BigEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 8
pub const MIN_UNITS_PER_VALUE: usize = 8
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (f64, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (f64, NonZeroUsize)
Decodes a value from input starting at 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.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:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: f64,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: f64, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Source§impl BinaryCodec<f64, LittleEndian>
impl BinaryCodec<f64, LittleEndian>
Sourcepub const MIN_UNITS_PER_VALUE: usize = 8
pub const MIN_UNITS_PER_VALUE: usize = 8
Minimum number of bytes required to encode or decode this type.
Sourcepub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
pub const MAX_UNITS_PER_VALUE: usize = Self::MIN_UNITS_PER_VALUE
Maximum number of bytes required to encode or decode this type.
Sourcepub unsafe fn decode_unchecked(
input: &[u8],
index: usize,
) -> (f64, NonZeroUsize)
pub unsafe fn decode_unchecked( input: &[u8], index: usize, ) -> (f64, NonZeroUsize)
Decodes a value from input starting at 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.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:
index + Self::MIN_UNITS_PER_VALUE <= input.len()input[index..index + Self::MIN_UNITS_PER_VALUE]is valid for reading.
Sourcepub unsafe fn encode_unchecked(
value: f64,
output: &mut [u8],
index: usize,
) -> usize
pub unsafe fn encode_unchecked( value: f64, output: &mut [u8], index: usize, ) -> usize
Encodes value into output starting at 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.index: Start byte index inoutput.
§Safety
The caller must guarantee that:
index + Self::MAX_UNITS_PER_VALUE <= output.len()output[index..index + Self::MAX_UNITS_PER_VALUE]is valid for writing.
Trait Implementations§
Source§impl<T: Clone, O: Clone> Clone for BinaryCodec<T, O>
impl<T: Clone, O: Clone> Clone for BinaryCodec<T, O>
Source§fn clone(&self) -> BinaryCodec<T, O>
fn clone(&self) -> BinaryCodec<T, O>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Codec for BinaryCodec<f32, BigEndian>
impl Codec for BinaryCodec<f32, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(f32, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(f32, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &f32,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &f32, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<f32, LittleEndian>
impl Codec for BinaryCodec<f32, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(f32, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(f32, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &f32,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &f32, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<f64, BigEndian>
impl Codec for BinaryCodec<f64, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(f64, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(f64, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &f64,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &f64, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<f64, LittleEndian>
impl Codec for BinaryCodec<f64, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(f64, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(f64, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &f64,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &f64, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i128, BigEndian>
impl Codec for BinaryCodec<i128, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i128, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i128, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i128,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i128, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i128, LittleEndian>
impl Codec for BinaryCodec<i128, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i128, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i128, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i128,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i128, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i16, BigEndian>
impl Codec for BinaryCodec<i16, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i16, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i16, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i16,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i16, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i16, LittleEndian>
impl Codec for BinaryCodec<i16, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i16, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i16, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i16,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i16, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i32, BigEndian>
impl Codec for BinaryCodec<i32, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i32, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i32, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i32,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i32, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i32, LittleEndian>
impl Codec for BinaryCodec<i32, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i32, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i32, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i32,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i32, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i64, BigEndian>
impl Codec for BinaryCodec<i64, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i64, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i64, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i64,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i64, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<i64, LittleEndian>
impl Codec for BinaryCodec<i64, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i64, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i64, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i64,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i64, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl<O> Codec for BinaryCodec<i8, O>
impl<O> Codec for BinaryCodec<i8, O>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(i8, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(i8, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &i8,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &i8, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u128, BigEndian>
impl Codec for BinaryCodec<u128, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u128, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u128, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u128,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u128, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u128, LittleEndian>
impl Codec for BinaryCodec<u128, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u128, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u128, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u128,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u128, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u16, BigEndian>
impl Codec for BinaryCodec<u16, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u16, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u16, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u16,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u16, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u16, LittleEndian>
impl Codec for BinaryCodec<u16, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u16, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u16, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u16,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u16, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u32, BigEndian>
impl Codec for BinaryCodec<u32, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u32, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u32, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u32,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u32, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u32, LittleEndian>
impl Codec for BinaryCodec<u32, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u32, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u32, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u32,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u32, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u64, BigEndian>
impl Codec for BinaryCodec<u64, BigEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u64, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u64, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u64,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u64, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl Codec for BinaryCodec<u64, LittleEndian>
impl Codec for BinaryCodec<u64, LittleEndian>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u64, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u64, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u64,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u64, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
Source§impl<O> Codec for BinaryCodec<u8, O>
impl<O> Codec for BinaryCodec<u8, O>
Source§type DecodeError = Infallible
type DecodeError = Infallible
Source§type EncodeError = Infallible
type EncodeError = Infallible
Source§fn min_units_per_value(&self) -> NonZeroUsize
fn min_units_per_value(&self) -> NonZeroUsize
Source§fn max_units_per_value(&self) -> NonZeroUsize
fn max_units_per_value(&self) -> NonZeroUsize
Source§unsafe fn decode_unchecked(
&self,
input: &[u8],
index: usize,
) -> Result<(u8, NonZeroUsize), Self::DecodeError>
unsafe fn decode_unchecked( &self, input: &[u8], index: usize, ) -> Result<(u8, NonZeroUsize), Self::DecodeError>
Source§unsafe fn encode_unchecked(
&self,
value: &u8,
output: &mut [u8],
index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode_unchecked( &self, value: &u8, output: &mut [u8], index: usize, ) -> Result<usize, Self::EncodeError>
impl<T: Copy, O: Copy> Copy for BinaryCodec<T, O>
Source§impl<T: Default, O: Default> Default for BinaryCodec<T, O>
impl<T: Default, O: Default> Default for BinaryCodec<T, O>
Source§fn default() -> BinaryCodec<T, O>
fn default() -> BinaryCodec<T, O>
impl<T: Eq, O: Eq> Eq for BinaryCodec<T, O>
Source§impl<T: PartialEq, O: PartialEq> PartialEq for BinaryCodec<T, O>
impl<T: PartialEq, O: PartialEq> PartialEq for BinaryCodec<T, O>
Source§fn eq(&self, other: &BinaryCodec<T, O>) -> bool
fn eq(&self, other: &BinaryCodec<T, O>) -> bool
self and other values to be equal, and is used by ==.