Trait cipher::stream::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.

Object Safety§

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§