Struct SecDed64

Source
#[repr(C)]
pub struct SecDed64 { /* private fields */ }
Expand description

A very efficient SecDedCodec implementation based on u64.

Implementations§

Source§

impl SecDed64

Source

pub fn new(encodable_size: usize) -> Self

Trait Implementations§

Source§

impl SecDedCodec for SecDed64

Source§

fn encode(&self, buffer: &mut [u8])

Encodes the data IN-PLACE

§Arguments:
  • data: The slice of data to encode. The last secded.code_size() bits MUST be set to 0.
§Panics:

Panics if data.len() != 8

Unless you use the no-panics feature, encoding will also panic if the data you try to encode has some bits set to 1 in the reserved space, or past the encodable_size() + code_size() rightmost bits

Source§

fn decode(&self, buffer: &mut [u8]) -> Result<(), ()>

Decodes the data IN-PLACE

§Arguments:
  • data: The slice of data to decode.
    The last secded.code_size() bits will be reset to 0, a single error will be corrected implicitly.
§Returns:

Ok(()) if the data slice’s correctness has been checked: 0 error found or 1 found and corrected. Err(()) if 2 errors were detected.

§Panics:

Panics if data.len() != 8

Source§

fn encodable_size(&self) -> usize

Returns the number of bits that this SecDedCodec can encode.
Source§

fn code_size(&self) -> usize

Returns the size of the correction code that will be appended to the data.
Source§

fn expected_slice_size(&self) -> Option<usize>

Returns Some(size) if the implementation would panic if data.len() != size

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.