Struct stm32_hal2::crc::Polynomial
source · [−]pub struct Polynomial(_);
Expand description
A CRC polynomial.
The STM32H7 CRC unit only supports odd polynomials, and the constructors
will check to ensure the polynomial is odd unless the _unchecked
variants
are used.
Even polynomials are essentially never used in CRCs, so you most likely don’t need to worry about this if you aren’t creating your own algorithm.
A polynomial being even means that the least significant bit is 0
in the polynomial’s normal representation.
Implementations
sourceimpl Polynomial
impl Polynomial
sourcepub fn bits7(poly: u8) -> Result<Self, PolynomialError>
pub fn bits7(poly: u8) -> Result<Self, PolynomialError>
Create a 7-bit polynomial. Returns an error if the polynomial passed has the MSB set or is even.
sourcepub fn bits8(poly: u8) -> Result<Self, PolynomialError>
pub fn bits8(poly: u8) -> Result<Self, PolynomialError>
Create an 8-bit polynomial. Returns an error if the polynomial passed is even.
sourcepub fn bits16(poly: u16) -> Result<Self, PolynomialError>
pub fn bits16(poly: u16) -> Result<Self, PolynomialError>
Create a 16-bit polynomial. Returns an error if the polynomial passed is even.
sourcepub fn bits32(poly: u32) -> Result<Self, PolynomialError>
pub fn bits32(poly: u32) -> Result<Self, PolynomialError>
Create a 32-bit polynomial. Returns an error if the polynomial passed is even.
sourcepub const fn bits7_unchecked(poly: u8) -> Self
pub const fn bits7_unchecked(poly: u8) -> Self
Create a 7-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
sourcepub const fn bits8_unchecked(poly: u8) -> Self
pub const fn bits8_unchecked(poly: u8) -> Self
Create an 8-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
sourcepub const fn bits16_unchecked(poly: u16) -> Self
pub const fn bits16_unchecked(poly: u16) -> Self
Create a 16-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
sourcepub const fn bits32_unchecked(poly: u32) -> Self
pub const fn bits32_unchecked(poly: u32) -> Self
Create a 32-bit polynomial. If the polynomial passed is even the CRC unit will give incorrect results.
Trait Implementations
sourceimpl Clone for Polynomial
impl Clone for Polynomial
sourcefn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Polynomial
impl Debug for Polynomial
sourceimpl Default for Polynomial
impl Default for Polynomial
sourceimpl PartialEq<Polynomial> for Polynomial
impl PartialEq<Polynomial> for Polynomial
sourcefn eq(&self, other: &Polynomial) -> bool
fn eq(&self, other: &Polynomial) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Polynomial) -> bool
fn ne(&self, other: &Polynomial) -> bool
This method tests for !=
.
impl Copy for Polynomial
impl StructuralPartialEq for Polynomial
Auto Trait Implementations
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more