c2_chacha::stream_cipher

Trait SeekNum

Source
pub trait SeekNum:
    Sized
    + TryInto<u8>
    + TryFrom<u8>
    + TryInto<i8>
    + TryFrom<i8>
    + TryInto<u16>
    + TryFrom<u16>
    + TryInto<i16>
    + TryFrom<i16>
    + TryInto<u32>
    + TryFrom<u32>
    + TryInto<i32>
    + TryFrom<i32>
    + TryInto<u64>
    + TryFrom<u64>
    + TryInto<i64>
    + TryFrom<i64>
    + TryInto<u128>
    + TryFrom<u128>
    + TryInto<i128>
    + TryFrom<i128>
    + TryInto<usize>
    + TryFrom<usize>
    + TryInto<isize>
    + TryFrom<isize> {
    // Required methods
    fn from_block_byte<T>(
        block: T,
        byte: u8,
        bs: u8,
    ) -> Result<Self, OverflowError>
       where T: SeekNum;
    fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
       where T: SeekNum;
}
Expand description

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

This trait is implemented for primitive numeric types, i.e. i/u8, i/u16, i/u32, i/u64, i/u128, and i/usize. It is not intended to be implemented in third-party crates.

Required Methods§

Source

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

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

Source

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: SeekNum,

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 i8

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<i8, OverflowError>
where T: TryInto<i8>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<i8>,

Source§

impl SeekNum for i16

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<i16, OverflowError>
where T: TryInto<i16>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<i16>,

Source§

impl SeekNum for i32

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<i32, OverflowError>
where T: TryInto<i32>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<i32>,

Source§

impl SeekNum for i64

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<i64, OverflowError>
where T: TryInto<i64>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<i64>,

Source§

impl SeekNum for i128

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<i128, OverflowError>
where T: TryInto<i128>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<i128>,

Source§

impl SeekNum for isize

Source§

fn from_block_byte<T>( block: T, byte: u8, bs: u8, ) -> Result<isize, OverflowError>
where T: TryInto<isize>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<isize>,

Source§

impl SeekNum for u8

Source§

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

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<u8>,

Source§

impl SeekNum for u16

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<u16, OverflowError>
where T: TryInto<u16>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<u16>,

Source§

impl SeekNum for u32

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<u32, OverflowError>
where T: TryInto<u32>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<u32>,

Source§

impl SeekNum for u64

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<u64, OverflowError>
where T: TryInto<u64>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<u64>,

Source§

impl SeekNum for u128

Source§

fn from_block_byte<T>(block: T, byte: u8, bs: u8) -> Result<u128, OverflowError>
where T: TryInto<u128>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<u128>,

Source§

impl SeekNum for usize

Source§

fn from_block_byte<T>( block: T, byte: u8, bs: u8, ) -> Result<usize, OverflowError>
where T: TryInto<usize>,

Source§

fn to_block_byte<T>(self, bs: u8) -> Result<(T, u8), OverflowError>
where T: TryFrom<usize>,

Implementors§