pub struct Base64QuantumCodec { /* private fields */ }Expand description
Encodes and decodes one complete Base64 quantum.
A quantum maps exactly three raw bytes to four Base64 units. It does not
handle final short input groups or = padding; callers that process streams
must finalize those cases in a transcoder or facade layer.
Implementations§
Trait Implementations§
Source§impl Clone for Base64QuantumCodec
impl Clone for Base64QuantumCodec
Source§impl Codec for Base64QuantumCodec
impl Codec for Base64QuantumCodec
Source§unsafe fn decode(
&mut self,
input: &[u8],
input_index: usize,
) -> Result<([u8; 3], NonZeroUsize), DecodeFailure<Self::DecodeError>>
unsafe fn decode( &mut self, input: &[u8], input_index: usize, ) -> Result<([u8; 3], NonZeroUsize), DecodeFailure<Self::DecodeError>>
Decodes one complete four-unit Base64 quantum.
§Safety
The caller must provide four readable units at input_index.
Source§unsafe fn encode(
&mut self,
value: &[u8; 3],
output: &mut [u8],
output_index: usize,
) -> Result<usize, Self::EncodeError>
unsafe fn encode( &mut self, value: &[u8; 3], output: &mut [u8], output_index: usize, ) -> Result<usize, Self::EncodeError>
Encodes one complete three-byte Base64 quantum.
§Safety
The caller must provide four writable output units at output_index.
Source§const MIN_UNITS_PER_VALUE: usize = 4
const MIN_UNITS_PER_VALUE: usize = 4
The minimum possible non-zero readable unit count for one decoded value. Read more
Source§const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
const MAX_ENCODE_UNITS_PER_VALUE: usize = 4
The maximum unit count emitted when encoding one value. Read more
Source§const MAX_DECODE_UNITS_PER_VALUE: usize = 4
const MAX_DECODE_UNITS_PER_VALUE: usize = 4
The maximum non-zero unit count consumed to decode one value. Read more
Source§type DecodeError = MiscCodecError
type DecodeError = MiscCodecError
The type of errors reported when decoding malformed units.
Source§type EncodeError = MiscCodecError
type EncodeError = MiscCodecError
The type of errors reported when encoding an unsupported value.
Source§const MAX_ENCODE_RESET_UNITS: usize = 0
const MAX_ENCODE_RESET_UNITS: usize = 0
The maximum unit count emitted when resetting encode state. Read more
Source§const MAX_ENCODE_FINISH_UNITS: usize = 0
const MAX_ENCODE_FINISH_UNITS: usize = 0
The maximum unit count emitted when finishing encode state at EOF. Read more
Source§const MAX_DECODE_RESET_VALUES: usize = 0
const MAX_DECODE_RESET_VALUES: usize = 0
The maximum value count emitted when resetting decode state. Read more
Source§const MAX_DECODE_FINISH_VALUES: usize = 0
const MAX_DECODE_FINISH_VALUES: usize = 0
The maximum value count emitted when finishing decode state. Read more
Source§fn can_encode_value(&self, _value: &Self::Value) -> bool
fn can_encode_value(&self, _value: &Self::Value) -> bool
Returns whether
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
Returns the exact unit count this codec will write when encoding
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>
Emits stream-start output and resets encode-side state. Read more
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>
Emits EOF trailer output and finishes encode-side state. Read more
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>
Emits stream-start values and resets decode-side state. Read more
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>>
Decodes one value after the caller has established end of input. Read more
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>
Finishes decode-side EOF state into
output. Read moreimpl Copy for Base64QuantumCodec
Source§impl Debug for Base64QuantumCodec
impl Debug for Base64QuantumCodec
Source§impl Default for Base64QuantumCodec
impl Default for Base64QuantumCodec
impl Eq for Base64QuantumCodec
Source§impl PartialEq for Base64QuantumCodec
impl PartialEq for Base64QuantumCodec
impl StructuralPartialEq for Base64QuantumCodec
Auto Trait Implementations§
impl Freeze for Base64QuantumCodec
impl RefUnwindSafe for Base64QuantumCodec
impl Send for Base64QuantumCodec
impl Sync for Base64QuantumCodec
impl Unpin for Base64QuantumCodec
impl UnsafeUnpin for Base64QuantumCodec
impl UnwindSafe for Base64QuantumCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more