Skip to main content

Polynomial

Struct Polynomial 

Source
pub struct Polynomial { /* private fields */ }
Expand description

A polynomial over GF(256) with at most 255 coefficients.

Coefficients are stored from degree 0 upward in a fixed stack-allocated array, so the type is Copy and never allocates.

Implementations§

Source§

impl Polynomial

Source

pub const MAX_DEGREE: u8 = POLYNOMIAL_MAX_DEGREE_U8

Maximum degree of a polynomial over GF(256).

Source

pub const MAX_COEFFICIENTS: u8 = POLYNOMIAL_MAX_COEFFICIENTS_U8

Maximum number of coefficients in a polynomial.

Source§

impl Polynomial

Source

pub fn coefficients(&self) -> &[u8]

Returns the coefficients of this polynomial, from degree 0 to the leading term.

§Panics

Panics if the stored degree is 255, which exceeds Polynomial::MAX_DEGREE and cannot occur for a valid polynomial.

Source§

impl Polynomial

Source

pub const fn degree(&self) -> u8

Returns the degree of this polynomial.

The zero polynomial has degree 0 by this definition.

Source§

impl Polynomial

Source

pub fn div_rem( &self, divisor: impl AsRef<[u8]>, ) -> Result<(Self, Self), PolynomialDivError>

Divides this polynomial by a divisor, returning (quotient, remainder).

The divisor is interpreted as coefficients in ascending degree order. Trailing zeros are ignored when determining the divisor’s degree.

§Errors

Returns ZeroDivisor if the divisor is the zero polynomial.

Source§

impl Polynomial

Source

pub fn div_rem_inplace( &mut self, divisor: &Self, quotient: &mut Self, ) -> Result<(), PolynomialDivError>

In-place polynomial division: self becomes the remainder, quotient is output.

After this method, self contains the remainder and quotient contains the quotient of dividing the original self by divisor.

§Errors

Returns PolynomialDivError::ZeroDivisor if the divisor is the zero polynomial. Returns PolynomialDivError::GFError if field inversion fails.

Source§

impl Polynomial

Source

pub fn eval_at(&self, x: u8) -> u8

Evaluates this polynomial at the given point.

Source§

impl Polynomial

Source

pub fn eval_coefficient_iter_at<I>(coefficients: I, x: u8) -> u8
where I: DoubleEndedIterator<Item = u8>,

Evaluates a polynomial from an iterator of coefficients at the given point.

Coefficients are yielded from degree 0 (constant term) to the leading term. Requires DoubleEndedIterator for Horner’s method.

Source§

impl Polynomial

Source

pub fn eval_coefficient_slices_at(slices: &[&[u8]], x: u8) -> u8

Evaluates a polynomial from multiple coefficient slices at the given point.

Slices are concatenated in order, with the first slice containing the lowest degree terms.

Source§

impl Polynomial

Source

pub fn eval_coefficients_at(coefficients: &[u8], x: u8) -> u8

Evaluates a polynomial given its coefficients at the given point using Horner’s method.

Coefficients are ordered from degree 0 (constant term) to the leading term.

Source§

impl Polynomial

Source

pub fn eval_coefficients_derivative_at(coefficients: &[u8], x: u8) -> u8

Evaluates the formal derivative of a polynomial at the given point.

In characteristic 2, only odd-degree terms contribute to the derivative: p’(x) = a₁ + a₃x² + a₅x⁴ + …

Coefficients are ordered from degree 0 (constant term) to the leading term.

Source§

impl Polynomial

Source

pub fn eval_derivative_at(&self, x: u8) -> u8

Evaluates the formal derivative of this polynomial at the given point.

In characteristic 2, only odd-degree terms contribute to the derivative.

Source§

impl Polynomial

Source

pub fn first_n_coefficients(&self, n: usize) -> &[u8]

Returns the first n coefficients.

The returned slice has length min(n, 255).

Source§

impl Polynomial

Source

pub fn from_slice(coeffs: &[u8]) -> Result<Self, PolynomialFromSliceError>

Creates a polynomial from a slice of coefficients.

Coefficients are ordered from degree 0 (constant term) to the leading term.

§Errors

Returns PolynomialFromSliceError::TooLong if the slice exceeds 255 elements.

Source§

impl Polynomial

Source

pub const fn is_zero(&self) -> bool

Returns true if this is the zero polynomial.

A polynomial is zero if all its coefficients are zero. Due to internal normalization, this is equivalent to having degree 0 and a zero constant term.

Source§

impl Polynomial

Source

pub fn iter(&self) -> Iter<'_, u8>

Returns an iterator over the coefficients, from degree 0 to the leading term.

Source§

impl Polynomial

Source

pub fn mul_xor_assign( &mut self, a: &Self, b: &Self, ) -> Result<(), PolynomialMulError>

Fused multiply-XOR: self ^= a * b

Computes the product of polynomials a and b, XORing the result into self. This avoids allocating an intermediate polynomial for the product.

In GF(2^8), XOR is equivalent to both addition and subtraction, so this computes self = self + a * b or equivalently self = self - a * b.

§Errors

Returns PolynomialMulError::DegreeOverflow if the product degree, a.degree() + b.degree(), exceeds Polynomial::MAX_DEGREE. self is unmodified on error.

Source§

impl Polynomial

Source

pub fn set(&mut self, idx: u8, value: u8)

Sets the coefficient of degree idx to value.

If value is non-zero and idx exceeds the current degree, the degree increases to idx. If value is zero and idx equals the current degree, the degree decreases to the next non-zero coefficient.

§Panics

Panics if idx exceeds 254, the maximum degree of a polynomial over GF(256).

Source§

impl Polynomial

Source

pub fn set_coefficients( &mut self, offset: u8, values: &[u8], ) -> Result<(), PolynomialSetCoefficientsError>

Sets coefficients starting at degree offset from a slice.

Copies values into the coefficient array at offset..offset + values.len(), then adjusts the degree accordingly.

Empty slices are a no-op.

§Errors

Returns OutOfBounds if offset + values.len() exceeds 255.

Trait Implementations§

Source§

impl<B: Borrow<u8>, I: IntoIterator<Item = B>> Add<I> for Polynomial

Source§

fn add(self, rhs: I) -> Self::Output

Adds coefficients from an iterator to this polynomial.

In GF(256), addition is XOR. This delegates to BitXor.

§Errors

Returns TooManyCoefficients if the iterator yields more than 255 elements.

Source§

type Output = Result<Polynomial, PolynomialXorError>

The resulting type after applying the + operator.
Source§

impl<B: Borrow<u8>, I: IntoIterator<Item = B>> Add<I> for &Polynomial

Source§

type Output = Result<Polynomial, PolynomialXorError>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Polynomial

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl AddAssign<&Polynomial> for Polynomial

Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl AsRef<[u8]> for Polynomial

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<B: Borrow<u8>, I: IntoIterator<Item = B>> BitXor<I> for Polynomial

Source§

fn bitxor(self, rhs: I) -> Self::Output

XORs coefficients from an iterator into this polynomial.

§Errors

Returns TooManyCoefficients if the iterator yields more than 255 elements.

Source§

type Output = Result<Polynomial, PolynomialXorError>

The resulting type after applying the ^ operator.
Source§

impl<B: Borrow<u8>, I: IntoIterator<Item = B>> BitXor<I> for &Polynomial

Source§

type Output = Result<Polynomial, PolynomialXorError>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: I) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXorAssign for Polynomial

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl BitXorAssign<&Polynomial> for Polynomial

Source§

fn bitxor_assign(&mut self, rhs: &Self)

Performs the ^= operation. Read more
Source§

impl Clone for Polynomial

Source§

fn clone(&self) -> Polynomial

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Polynomial

Source§

impl Debug for Polynomial

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Polynomial

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<D: AsRef<[u8]>> Div<D> for &Polynomial

Source§

fn div(self, rhs: D) -> Self::Output

Divides two polynomials over GF(256), returning the quotient.

§Errors

Returns ZeroDivisor if the divisor is the zero polynomial.

Source§

type Output = Result<Polynomial, PolynomialDivError>

The resulting type after applying the / operator.
Source§

impl<D: AsRef<[u8]>> Div<D> for Polynomial

Source§

type Output = Result<Polynomial, PolynomialDivError>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: D) -> Self::Output

Performs the / operation. Read more
Source§

impl Eq for Polynomial

Source§

impl FromIterator<u8> for Polynomial

Source§

fn from_iter<I: IntoIterator<Item = u8>>(iter: I) -> Self

Collects coefficients from degree 0 (constant term) to the leading term.

Consumes at most 255 elements; excess elements are ignored. Leading zeros are trimmed. Safe for infinite iterators.

Source§

impl Hash for Polynomial

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<u8> for Polynomial

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, index: u8) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Polynomial

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IntoIterator for Polynomial

Source§

type Item = u8

The type of the elements being iterated over.
Source§

type IntoIter = Take<IntoIter<u8, POLYNOMIAL_MAX_COEFFICIENTS>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a Polynomial

Source§

type Item = &'a u8

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, u8>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Mul for Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&Polynomial> for &Polynomial

Source§

fn mul(self, rhs: &Polynomial) -> Self::Output

Multiplies two polynomials over GF(256).

§Errors

Returns DegreeOverflow if the result degree exceeds 254.

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

impl Mul<&Polynomial> for Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<&[u8; N]> for &Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &[u8; N]) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<&[u8; N]> for Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &[u8; N]) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&[u8]> for &Polynomial

Source§

fn mul(self, rhs: &[u8]) -> Self::Output

Multiplies a polynomial by a coefficient slice over GF(256).

§Errors

Returns DegreeOverflow if the result degree exceeds 254.

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

impl Mul<&[u8]> for Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &[u8]) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Polynomial> for &Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Polynomial) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<[u8; N]> for &Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: [u8; N]) -> Self::Output

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<[u8; N]> for Polynomial

Source§

type Output = Result<Polynomial, PolynomialMulError>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: [u8; N]) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<u8> for Polynomial

Source§

fn mul_assign(&mut self, scalar: u8)

Multiplies all coefficients by a scalar in GF(2^8).

If scalar is zero, the result is the zero polynomial. Otherwise, the degree is preserved since GF(2^8) has no zero divisors.

Source§

impl Ord for Polynomial

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Polynomial

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Polynomial

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<D: AsRef<[u8]>> Rem<D> for &Polynomial

Source§

fn rem(self, rhs: D) -> Self::Output

Computes the remainder of polynomial division over GF(256).

§Errors

Returns ZeroDivisor if the divisor is the zero polynomial.

Source§

type Output = Result<Polynomial, PolynomialDivError>

The resulting type after applying the % operator.
Source§

impl<D: AsRef<[u8]>> Rem<D> for Polynomial

Source§

type Output = Result<Polynomial, PolynomialDivError>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: D) -> Self::Output

Performs the % operation. Read more
Source§

impl<B: Borrow<u8>, I: IntoIterator<Item = B>> Sub<I> for Polynomial

Source§

fn sub(self, rhs: I) -> Self::Output

Subtracts coefficients from an iterator from this polynomial.

In GF(256), subtraction is equivalent to addition, which is XOR. This delegates to BitXor.

§Errors

Returns TooManyCoefficients if the iterator yields more than 255 elements.

Source§

type Output = Result<Polynomial, PolynomialXorError>

The resulting type after applying the - operator.
Source§

impl<B: Borrow<u8>, I: IntoIterator<Item = B>> Sub<I> for &Polynomial

Source§

type Output = Result<Polynomial, PolynomialXorError>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign for Polynomial

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl SubAssign<&Polynomial> for Polynomial

Source§

fn sub_assign(&mut self, rhs: &Self)

Performs the -= operation. Read more
Source§

impl<const N: usize> TryFrom<&[u8; N]> for Polynomial

Source§

type Error = PolynomialFromSliceError

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

fn try_from(value: &[u8; N]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&[u8]> for Polynomial

Source§

type Error = PolynomialFromSliceError

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

fn try_from(value: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const N: usize> TryFrom<[u8; N]> for Polynomial

Source§

type Error = PolynomialFromSliceError

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

fn try_from(value: [u8; N]) -> Result<Self, Self::Error>

Performs the conversion.

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<A, T> Array<T> for A
where A: AsRef<[T]>,

Source§

fn at(&self, index: usize) -> Option<&T>

Returns a reference to the element at the specified index, or None if the index is out of bounds. Read more
Source§

fn concat(&self, other: impl AsRef<[T]>) -> Vec<T>
where T: Clone,

Concatenates this array with another slice and returns a new vector. Read more
Source§

fn entries<'a>(&'a self) -> impl Iterator<Item = (usize, &'a T)>
where T: 'a,

Returns an iterator of (index, &T) tuples for each element. Read more
Source§

fn every(&self, predicate: impl FnMut(&T) -> bool) -> bool

Tests whether all elements match the predicate. Read more
Source§

fn every_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> bool

Tests whether all elements are equal to the comparator target. Read more
Source§

fn filter(&self, predicate: impl FnMut(&T) -> bool) -> Vec<T>
where T: Clone,

Returns a vector containing all elements that match the predicate. Read more
Source§

fn filter_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> Vec<T>
where T: Clone,

Returns all elements equal to the comparator target. Read more
Source§

fn find(&self, predicate: impl FnMut(&T) -> bool) -> Option<&T>

Returns a reference to the first element that matches the predicate. Read more
Source§

fn find_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> Option<&T>

Returns the first element equal to the comparator target. Read more
Source§

fn find_index(&self, predicate: impl FnMut(&T) -> bool) -> Option<usize>

Returns the index of the first element that matches the predicate. Read more
Source§

fn find_index_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> Option<usize>

Returns the index of the first element equal to the comparator target. Read more
Source§

fn find_last(&self, predicate: impl FnMut(&T) -> bool) -> Option<&T>

Returns a reference to the last element that matches the predicate. Read more
Source§

fn find_last_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> Option<&T>

Returns the last element equal to the comparator target. Read more
Source§

fn find_last_index(&self, predicate: impl FnMut(&T) -> bool) -> Option<usize>

Returns the index of the last element that matches the predicate. Read more
Source§

fn find_last_index_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> Option<usize>

Returns the index of the last element equal to the comparator target. Read more
Source§

fn flat<'a, O>(&'a self) -> Vec<O>
where T: 'a, &'a T: IntoIterator<Item = &'a O>, O: Clone + 'a,

Flattens a level of nesting in an array of iterables. Read more
Source§

fn flat_map<O, I>(&self, mapper: impl FnMut(&T) -> I) -> Vec<O>
where I: IntoIterator<Item = O>,

Maps each element to an iterable and flattens the result. Read more
Source§

fn for_each(&self, cb: impl FnMut(&T))

Applies a closure to each element for side effects. Read more
Source§

fn includes(&self, value: &T) -> bool
where T: PartialEq,

Checks whether the array contains the specified value. Read more
Source§

fn index_of(&self, value: &T) -> Option<usize>
where T: PartialEq,

Returns the index of the first occurrence of the specified value, or None if not found. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the array is empty. Read more
Source§

fn join<S>(&self, separator: &S) -> String
where S: Display + ?Sized, T: Display,

Concatenates all elements into a string, separated by the given separator. Read more
Source§

fn keys(&self) -> impl Iterator<Item = usize>

Returns an iterator of indices (0, 1, 2, …). Read more
Source§

fn last_index_of(&self, value: &T) -> Option<usize>
where T: PartialEq,

Returns the index of the last occurrence of the specified value, or None if not found. Read more
Source§

fn len(&self) -> usize

Returns the number of elements in the array. Read more
Source§

fn map<O>(&self, mapper: impl FnMut(&T) -> O) -> Vec<O>

Transforms each element using the provided mapper function and returns a vector of the results. Read more
Source§

fn reduce<O>(&self, reducer: impl FnMut(O, &T) -> O, initial: O) -> O

Reduces the array to a single value by applying a callback with an accumulator, starting from the left. Read more
Source§

fn reduce_right<O>(&self, reducer: impl FnMut(O, &T) -> O, initial: O) -> O

Reduces the array to a single value by applying a callback with an accumulator, starting from the right. Read more
Source§

fn slice(&self, start: usize, end: Option<usize>) -> &[T]

Returns a slice of the array from start to end (exclusive). Read more
Source§

fn slice_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> &[T]

Returns the subslice of all elements equal to the comparator target. Read more
Source§

fn some(&self, predicate: impl FnMut(&T) -> bool) -> bool

Tests whether any element matches the predicate. Read more
Source§

fn some_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> bool

Tests whether any element is equal to the comparator target. Read more
Source§

fn none(&self, predicate: impl FnMut(&T) -> bool) -> bool

Tests whether no elements match the predicate. Read more
Source§

fn none_equal_in_sorted_by( &self, comparator: impl FnMut(&T) -> Ordering, ) -> bool

Tests whether no element is equal to the comparator target. Read more
Source§

fn subarray<const S: usize>(&self, index: usize) -> &[T; S]

Returns a fixed-size array reference starting at the given index. Read more
Source§

fn subarray_checked<const S: usize>(&self, index: usize) -> Option<&[T; S]>

Checked version of subarray. Returns None if bounds are exceeded. Read more
Source§

unsafe fn subarray_unchecked<const S: usize>(&self, index: usize) -> &[T; S]

Unchecked version of subarray. Undefined behavior if bounds are exceeded. Read more
Source§

fn values<'a>(&'a self) -> impl Iterator<Item = &'a T>
where T: 'a,

Returns an iterator over references to the elements. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToBuffer for T
where T: AsRef<[u8]>,

Source§

fn to_buffer(self) -> Result<Buffer, BufferError>

Creates a new Buffer containing the byte representation of self. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToResult for T

Source§

fn ok<Err>(self) -> Result<Self, Err>
where Self: Sized,

Wraps self in Ok(self).
Source§

fn err<Any>(self) -> Result<Any, Self>
where Self: Sized,

Wraps self in Err(self).
Source§

fn some(self) -> Option<Self>
where Self: Sized,

Wraps self in Some(self).
Source§

impl<T> ToSharedBuffer for T
where T: AsRef<[u8]>,

Source§

fn to_shared_buffer(self) -> Result<SharedBuffer, BufferError>

Creates a new SharedBuffer containing the byte representation of self. Read more
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.