pub trait CtrFlavor<B: ArrayLength<u8>> {
type CtrNonce: Clone;
type Backend: Counter;
const NAME: &'static str;
// Required methods
fn remaining(cn: &Self::CtrNonce) -> Option<usize>;
fn next_block(cn: &mut Self::CtrNonce) -> GenericArray<u8, B>;
fn current_block(cn: &Self::CtrNonce) -> GenericArray<u8, B>;
fn from_nonce(block: &GenericArray<u8, B>) -> Self::CtrNonce;
fn set_from_backend(cn: &mut Self::CtrNonce, v: Self::Backend);
fn as_backend(cn: &Self::CtrNonce) -> Self::Backend;
}
Expand description
Trait implemented by different CTR flavors.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn remaining(cn: &Self::CtrNonce) -> Option<usize>
fn remaining(cn: &Self::CtrNonce) -> Option<usize>
Return number of remaining blocks.
If result does not fit into usize
, returns None
.
Sourcefn next_block(cn: &mut Self::CtrNonce) -> GenericArray<u8, B>
fn next_block(cn: &mut Self::CtrNonce) -> GenericArray<u8, B>
Generate block for given nonce
and current counter value.
Sourcefn current_block(cn: &Self::CtrNonce) -> GenericArray<u8, B>
fn current_block(cn: &Self::CtrNonce) -> GenericArray<u8, B>
Generate block for given nonce
and current counter value.
Sourcefn from_nonce(block: &GenericArray<u8, B>) -> Self::CtrNonce
fn from_nonce(block: &GenericArray<u8, B>) -> Self::CtrNonce
Initialize from bytes.
Sourcefn set_from_backend(cn: &mut Self::CtrNonce, v: Self::Backend)
fn set_from_backend(cn: &mut Self::CtrNonce, v: Self::Backend)
Convert from a backend value
Sourcefn as_backend(cn: &Self::CtrNonce) -> Self::Backend
fn as_backend(cn: &Self::CtrNonce) -> Self::Backend
Convert to a backend value
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.