cipher

Trait SeekNum

Source
pub trait SeekNum: Sized {
    // Required methods
    fn from_block_byte<T: Counter>(
        block: T,
        byte: u8,
        bs: u8,
    ) -> Result<Self, OverflowError>;
    fn into_block_byte<T: Counter>(
        self,
        bs: u8,
    ) -> Result<(T, u8), OverflowError>;
}
Expand description

Trait implemented for numeric types which can be used with the StreamCipherSeek trait.

This trait is implemented for i32, u32, u64, u128, and usize. It is not intended to be implemented in third-party crates.

Required Methods§

Source

fn from_block_byte<T: Counter>( block: T, byte: u8, bs: u8, ) -> Result<Self, OverflowError>

Try to get position for block number block, byte position inside block byte, and block size bs.

Source

fn into_block_byte<T: Counter>(self, bs: u8) -> Result<(T, u8), OverflowError>

Try to get block number and bytes position for given block size bs.

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.

Implementations on Foreign Types§

Source§

impl SeekNum for i32

Source§

fn from_block_byte<T: Counter>( block: T, byte: u8, bs: u8, ) -> Result<Self, OverflowError>

Source§

fn into_block_byte<T: Counter>(self, bs: u8) -> Result<(T, u8), OverflowError>

Source§

impl SeekNum for u32

Source§

fn from_block_byte<T: Counter>( block: T, byte: u8, bs: u8, ) -> Result<Self, OverflowError>

Source§

fn into_block_byte<T: Counter>(self, bs: u8) -> Result<(T, u8), OverflowError>

Source§

impl SeekNum for u64

Source§

fn from_block_byte<T: Counter>( block: T, byte: u8, bs: u8, ) -> Result<Self, OverflowError>

Source§

fn into_block_byte<T: Counter>(self, bs: u8) -> Result<(T, u8), OverflowError>

Source§

impl SeekNum for u128

Source§

fn from_block_byte<T: Counter>( block: T, byte: u8, bs: u8, ) -> Result<Self, OverflowError>

Source§

fn into_block_byte<T: Counter>(self, bs: u8) -> Result<(T, u8), OverflowError>

Source§

impl SeekNum for usize

Source§

fn from_block_byte<T: Counter>( block: T, byte: u8, bs: u8, ) -> Result<Self, OverflowError>

Source§

fn into_block_byte<T: Counter>(self, bs: u8) -> Result<(T, u8), OverflowError>

Implementors§