StreamCipherSeek

Trait StreamCipherSeek 

Source
pub trait StreamCipherSeek {
    // Required methods
    fn try_current_pos<T: SeekNum>(&self) -> Result<T, OverflowError>;
    fn try_seek<T: SeekNum>(&mut self, pos: T) -> Result<(), StreamCipherError>;

    // Provided methods
    fn current_pos<T: SeekNum>(&self) -> T { ... }
    fn seek<T: SeekNum>(&mut self, pos: T) { ... }
}
Expand description

Trait for seekable stream ciphers.

Methods of this trait are generic over the SeekNum trait, i.e. they can be used with i32, u32, u64, u128, and usize.

Required Methods§

Source

fn try_current_pos<T: SeekNum>(&self) -> Result<T, OverflowError>

Try to get current keystream position in bytes.

§Errors

Returns OverflowError if the position value can not be represented by type T.

Source

fn try_seek<T: SeekNum>(&mut self, pos: T) -> Result<(), StreamCipherError>

Try to seek to the provided position in bytes.

§Errors

Returns StreamCipherError if the position value is bigger than keystream length.

Provided Methods§

Source

fn current_pos<T: SeekNum>(&self) -> T

Get current keystream position in bytes.

§Panics

If the position value can not be represented by type T.

Source

fn seek<T: SeekNum>(&mut self, pos: T)

Seek to the provided keystream position in bytes.

§Panics

If the position value is bigger than keystream length.

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.

Implementors§