pub struct StcConfig { /* private fields */ }Expand description
Parameters of one Syndrome-Trellis Codes operation.
Holds key material — the permutation seed — and is therefore wiped on drop. Encode and decode must be given identical configurations: the trellis height is part of the code definition, so a decode at a different height reads a different syndrome and recovers nothing.
Implementations§
Source§impl StcConfig
impl StcConfig
Sourcepub fn new(stc_seed: [u8; 32]) -> Self
pub fn new(stc_seed: [u8; 32]) -> Self
Builds a configuration around stc_seed, with the defaults of this
crate.
There is no constructor that takes a max_bpp. The field exists so the
limit can be read, not chosen.
Sourcepub fn trellis_height(&self) -> u32
pub fn trellis_height(&self) -> u32
Constraint height of the trellis.
Sourcepub fn capacity_bits(&self, positions: usize) -> usize
pub fn capacity_bits(&self, positions: usize) -> usize
Bits positions cover elements may carry under the ceiling.
Truncating towards zero, so the limit is never rounded up into a payload
that the ceiling does not actually allow. The arithmetic is done in
f32 deliberately: crate::stego::sizer advertises capacity with the
same expression, and a wider intermediate type here would let a payload
pass the sizer and then fail this check.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StcConfig
impl RefUnwindSafe for StcConfig
impl Send for StcConfig
impl Sync for StcConfig
impl Unpin for StcConfig
impl UnsafeUnpin for StcConfig
impl UnwindSafe for StcConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more