alloy_primitives

Struct FixedBytes

Source
#[repr(transparent)]
pub struct FixedBytes<const N: usize>(pub [u8; N]);
Expand description

A byte array of fixed length ([u8; N]).

This type allows us to more tightly control serialization, deserialization. rlp encoding, decoding, and other type-level attributes for fixed-length byte arrays.

Users looking to prevent type-confusion between byte arrays of different lengths should use the wrap_fixed_bytes! macro to create a new fixed-length byte array type.

Tuple Fields§

§0: [u8; N]

Implementations§

Source§

impl<const N: usize> FixedBytes<N>

Source

pub const ZERO: Self = _

Array of Zero bytes.

Source

pub const fn new(bytes: [u8; N]) -> Self

Wraps the given byte array in FixedBytes.

Source

pub const fn with_last_byte(x: u8) -> Self

Creates a new FixedBytes with the last byte set to x.

Source

pub const fn repeat_byte(byte: u8) -> Self

Creates a new FixedBytes where all bytes are set to byte.

Source

pub const fn len_bytes() -> usize

Returns the size of this byte array (N).

Source

pub fn random() -> Self

Available on crate feature getrandom only.

Creates a new FixedBytes with cryptographically random content.

§Panics

Panics if the underlying call to getrandom_uninit fails.

Source

pub fn try_random() -> Result<Self, Error>

Available on crate feature getrandom only.

Tries to create a new FixedBytes with cryptographically random content.

§Errors

This function only propagates the error from the underlying call to getrandom_uninit.

Source

pub fn random_with<R: Rng + ?Sized>(rng: &mut R) -> Self

Available on crate feature rand only.

Creates a new FixedBytes with the given random number generator.

Source

pub fn randomize(&mut self)

Available on crate feature getrandom only.

Fills this FixedBytes with cryptographically random content.

§Panics

Panics if the underlying call to getrandom_uninit fails.

Source

pub fn try_randomize(&mut self) -> Result<(), Error>

Available on crate feature getrandom only.

Tries to fill this FixedBytes with cryptographically random content.

§Errors

This function only propagates the error from the underlying call to getrandom_uninit.

Source

pub fn randomize_with<R: Rng + ?Sized>(&mut self, rng: &mut R)

Available on crate feature rand only.

Fills this FixedBytes with the given random number generator.

Source

pub const fn concat_const<const M: usize, const Z: usize>( self, other: FixedBytes<M>, ) -> FixedBytes<Z>

Concatenate two FixedBytes.

Due to constraints in the language, the user must specify the value of the output size Z.

§Panics

Panics if Z is not equal to N + M.

Source

pub fn from_slice(src: &[u8]) -> Self

Create a new FixedBytes from the given slice src.

For a fallible version, use the TryFrom<&[u8]> implementation.

§Note

The given bytes are interpreted in big endian order.

§Panics

If the length of src and the number of bytes in Self do not match.

Source

pub fn left_padding_from(value: &[u8]) -> Self

Create a new FixedBytes from the given slice src, left-padding it with zeroes if necessary.

§Note

The given bytes are interpreted in big endian order.

§Panics

Panics if src.len() > N.

Source

pub fn right_padding_from(value: &[u8]) -> Self

Create a new FixedBytes from the given slice src, right-padding it with zeroes if necessary.

§Note

The given bytes are interpreted in big endian order.

§Panics

Panics if src.len() > N.

Source

pub const fn as_slice(&self) -> &[u8]

Returns a slice containing the entire array. Equivalent to &s[..].

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Returns a mutable slice containing the entire array. Equivalent to &mut s[..].

Source

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

Returns true if all bits set in self are also set in b.

Source

pub const fn const_covers(self, other: Self) -> bool

Returns true if all bits set in self are also set in b.

Source

pub const fn const_eq(&self, other: &Self) -> bool

Compile-time equality. NOT constant-time equality.

Source

pub fn is_zero(&self) -> bool

Returns true if no bits are set.

Source

pub const fn const_is_zero(&self) -> bool

Returns true if no bits are set.

Source

pub const fn bit_and(self, rhs: Self) -> Self

Computes the bitwise AND of two FixedBytes.

Source

pub const fn bit_or(self, rhs: Self) -> Self

Computes the bitwise OR of two FixedBytes.

Source

pub const fn bit_xor(self, rhs: Self) -> Self

Computes the bitwise XOR of two FixedBytes.

Methods from Deref<Target = [u8; N]>§

Source

pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into an array of ASCII characters, or returns None if any of the characters is non-ASCII.

§Examples
#![feature(ascii_char)]

const HEX_DIGITS: [std::ascii::Char; 16] =
    *b"0123456789abcdef".as_ascii().unwrap();

assert_eq!(HEX_DIGITS[1].as_str(), "1");
assert_eq!(HEX_DIGITS[10].as_str(), "a");
Source

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into an array of ASCII characters, without checking whether they’re valid.

§Safety

Every byte in the array must be in 0..=127, or else this is UB.

1.57.0 · Source

pub fn as_slice(&self) -> &[T]

Returns a slice containing the entire array. Equivalent to &s[..].

1.57.0 · Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Returns a mutable slice containing the entire array. Equivalent to &mut s[..].

1.77.0 · Source

pub fn each_ref(&self) -> [&T; N]

Borrows each element and returns an array of references with the same size as self.

§Example
let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);
1.77.0 · Source

pub fn each_mut(&mut self) -> [&mut T; N]

Borrows each element mutably and returns an array of mutable references with the same size as self.

§Example

let mut floats = [3.1, 2.7, -1.0];
let float_refs: [&mut f64; 3] = floats.each_mut();
*float_refs[0] = 0.0;
assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
assert_eq!(floats, [0.0, 2.7, -1.0]);
Source

pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index.

The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.split_array_ref::<0>();
   assert_eq!(left, &[]);
   assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<2>();
    assert_eq!(left, &[1, 2]);
    assert_eq!(right, &[3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<6>();
    assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
    assert_eq!(right, &[]);
}
Source

pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])

🔬This is a nightly-only experimental API. (split_array)

Divides one mutable array reference into two at an index.

The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_array_mut::<2>();
assert_eq!(left, &mut [1, 0][..]);
assert_eq!(right, &mut [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
Source

pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index from the end.

The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.rsplit_array_ref::<0>();
   assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
   assert_eq!(right, &[]);
}

{
    let (left, right) = v.rsplit_array_ref::<2>();
    assert_eq!(left, &[1, 2, 3, 4]);
    assert_eq!(right, &[5, 6]);
}

{
    let (left, right) = v.rsplit_array_ref::<6>();
    assert_eq!(left, &[]);
    assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
Source

pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])

🔬This is a nightly-only experimental API. (split_array)

Divides one mutable array reference into two at an index from the end.

The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).

§Panics

Panics if M > N.

§Examples
#![feature(split_array)]

let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.rsplit_array_mut::<4>();
assert_eq!(left, &mut [1, 0]);
assert_eq!(right, &mut [3, 0, 5, 6][..]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

Trait Implementations§

Source§

impl<const N: usize> Allocative for FixedBytes<N>

Source§

fn visit<'allocative_a, 'allocative_b: 'allocative_a>( &self, visitor: &'allocative_a mut Visitor<'allocative_b>, )

Source§

impl<'arbitrary, const N: usize> Arbitrary<'arbitrary> for FixedBytes<N>

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl<const N: usize> Arbitrary for FixedBytes<N>

Source§

type Parameters = <[u8; N] as Arbitrary>::Parameters

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
Source§

type Strategy = Map<<[u8; N] as Arbitrary>::Strategy, fn(_: [u8; N]) -> FixedBytes<N>>

The type of Strategy used to generate values of type Self.
Source§

fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
Source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
Source§

impl<const N: usize> AsMut<[u8]> for FixedBytes<N>

Source§

fn as_mut(&mut self) -> &mut [u8]

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

impl<const N: usize> AsMut<[u8; N]> for FixedBytes<N>

Source§

fn as_mut(&mut self) -> &mut [u8; N]

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

impl AsMut<FixedBytes<20>> for Address

Source§

fn as_mut(&mut self) -> &mut FixedBytes<20>

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

impl AsMut<FixedBytes<24>> for Function

Source§

fn as_mut(&mut self) -> &mut FixedBytes<24>

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

impl AsMut<FixedBytes<256>> for Bloom

Source§

fn as_mut(&mut self) -> &mut FixedBytes<256>

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

impl<const N: usize> AsRef<[u8]> for FixedBytes<N>

Source§

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

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

impl<const N: usize> AsRef<[u8; N]> for FixedBytes<N>

Source§

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

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

impl AsRef<FixedBytes<20>> for Address

Source§

fn as_ref(&self) -> &FixedBytes<20>

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

impl AsRef<FixedBytes<24>> for Function

Source§

fn as_ref(&self) -> &FixedBytes<24>

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

impl AsRef<FixedBytes<256>> for Bloom

Source§

fn as_ref(&self) -> &FixedBytes<256>

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

impl<const N: usize> BitAnd for FixedBytes<N>

Source§

type Output = FixedBytes<N>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl<const N: usize> BitAndAssign for FixedBytes<N>

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl<const N: usize> BitOr for FixedBytes<N>

Source§

type Output = FixedBytes<N>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<const N: usize> BitOrAssign for FixedBytes<N>

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl<const N: usize> BitXor for FixedBytes<N>

Source§

type Output = FixedBytes<N>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

impl<const N: usize> BitXorAssign for FixedBytes<N>

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl<const N: usize> Borrow<[u8]> for &FixedBytes<N>

Source§

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

Immutably borrows from an owned value. Read more
Source§

impl<const N: usize> Borrow<[u8]> for &mut FixedBytes<N>

Source§

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

Immutably borrows from an owned value. Read more
Source§

impl<const N: usize> Borrow<[u8]> for FixedBytes<N>

Source§

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

Immutably borrows from an owned value. Read more
Source§

impl<const N: usize> Borrow<[u8; N]> for &FixedBytes<N>

Source§

fn borrow(&self) -> &[u8; N]

Immutably borrows from an owned value. Read more
Source§

impl<const N: usize> Borrow<[u8; N]> for &mut FixedBytes<N>

Source§

fn borrow(&self) -> &[u8; N]

Immutably borrows from an owned value. Read more
Source§

impl<const N: usize> Borrow<[u8; N]> for FixedBytes<N>

Source§

fn borrow(&self) -> &[u8; N]

Immutably borrows from an owned value. Read more
Source§

impl<const N: usize> BorrowMut<[u8]> for &mut FixedBytes<N>

Source§

fn borrow_mut(&mut self) -> &mut [u8]

Mutably borrows from an owned value. Read more
Source§

impl<const N: usize> BorrowMut<[u8]> for FixedBytes<N>

Source§

fn borrow_mut(&mut self) -> &mut [u8]

Mutably borrows from an owned value. Read more
Source§

impl<const N: usize> BorrowMut<[u8; N]> for &mut FixedBytes<N>

Source§

fn borrow_mut(&mut self) -> &mut [u8; N]

Mutably borrows from an owned value. Read more
Source§

impl<const N: usize> BorrowMut<[u8; N]> for FixedBytes<N>

Source§

fn borrow_mut(&mut self) -> &mut [u8; N]

Mutably borrows from an owned value. Read more
Source§

impl<const N: usize> Clone for FixedBytes<N>

Source§

fn clone(&self) -> FixedBytes<N>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for FixedBytes<N>

Source§

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

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

impl<const N: usize> Decodable for FixedBytes<N>

Available on crate feature rlp only.
Source§

fn decode(buf: &mut &[u8]) -> Result<Self>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
Source§

impl<const N: usize> Default for &FixedBytes<N>

Source§

fn default() -> Self

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

impl<const N: usize> Default for FixedBytes<N>

Source§

fn default() -> Self

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

impl<const N: usize> Deref for FixedBytes<N>

Source§

type Target = [u8; N]

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<const N: usize> DerefMut for FixedBytes<N>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de, const N: usize> Deserialize<'de> for FixedBytes<N>

Available on crate feature serde only.
Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const N: usize> Display for FixedBytes<N>

Source§

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

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

impl<const N: usize> Distribution<FixedBytes<N>> for Standard

Available on crate feature rand only.
Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> FixedBytes<N>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<const N: usize> Encodable for FixedBytes<N>

Available on crate feature rlp only.
Source§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
Source§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
Source§

impl<'a, const N: usize> From<&'a [u8; N]> for &'a FixedBytes<N>

Source§

fn from(value: &'a [u8; N]) -> &'a FixedBytes<N>

Converts to this type from the input type.
Source§

impl<const N: usize> From<&[u8; N]> for FixedBytes<N>

Source§

fn from(bytes: &[u8; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a FixedBytes<N>> for &'a [u8; N]

Source§

fn from(value: &'a FixedBytes<N>) -> &'a [u8; N]

Converts to this type from the input type.
Source§

impl<const N: usize> From<&'static FixedBytes<N>> for Bytes

Source§

fn from(value: &'static FixedBytes<N>) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a FixedBytes<N>

Source§

fn from(value: &'a mut [u8; N]) -> &'a FixedBytes<N>

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a mut [u8; N]> for &'a mut FixedBytes<N>

Source§

fn from(value: &'a mut [u8; N]) -> &'a mut FixedBytes<N>

Converts to this type from the input type.
Source§

impl<const N: usize> From<&mut [u8; N]> for FixedBytes<N>

Source§

fn from(bytes: &mut [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a [u8; N]

Source§

fn from(value: &'a mut FixedBytes<N>) -> &'a [u8; N]

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a mut FixedBytes<N>> for &'a mut [u8; N]

Source§

fn from(value: &'a mut FixedBytes<N>) -> &'a mut [u8; N]

Converts to this type from the input type.
Source§

impl<const N: usize> From<[u8; N]> for FixedBytes<N>

Source§

fn from(value: [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl From<Address> for FixedBytes<20>

Source§

fn from(value: Address) -> Self

Converts to this type from the input type.
Source§

impl From<Bloom> for FixedBytes<256>

Source§

fn from(value: Bloom) -> Self

Converts to this type from the input type.
Source§

impl From<FixedBytes<1>> for I8

Source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<1>> for U8

Source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<1>> for i8

Source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<1>> for u8

Source§

fn from(value: B8) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<16>> for I128

Source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<16>> for U128

Source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<16>> for i128

Source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<16>> for u128

Source§

fn from(value: B128) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<2>> for I16

Source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<2>> for U16

Source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<2>> for i16

Source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<2>> for u16

Source§

fn from(value: B16) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<20>> for Address

Source§

fn from(value: FixedBytes<20>) -> Self

Converts to this type from the input type.
Source§

impl From<FixedBytes<20>> for I160

Source§

fn from(value: B160) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<20>> for U160

Source§

fn from(value: B160) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<24>> for Function

Source§

fn from(value: FixedBytes<24>) -> Self

Converts to this type from the input type.
Source§

impl From<FixedBytes<256>> for Bloom

Source§

fn from(value: FixedBytes<256>) -> Self

Converts to this type from the input type.
Source§

impl From<FixedBytes<32>> for I256

Source§

fn from(value: B256) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<32>> for U256

Source§

fn from(value: B256) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<4>> for I32

Source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<4>> for U32

Source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<4>> for i32

Source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<4>> for u32

Source§

fn from(value: B32) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<64>> for I512

Source§

fn from(value: B512) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<64>> for U512

Source§

fn from(value: B512) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<8>> for I64

Source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<8>> for U64

Source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<8>> for i64

Source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl From<FixedBytes<8>> for u64

Source§

fn from(value: B64) -> Self

Converts a fixed byte array into a fixed-width unsigned integer by interpreting the bytes as big-endian.

Source§

impl<const N: usize> From<FixedBytes<N>> for [u8; N]

Source§

fn from(s: FixedBytes<N>) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<FixedBytes<N>> for Bytes

Source§

fn from(value: FixedBytes<N>) -> Self

Converts to this type from the input type.
Source§

impl From<Function> for FixedBytes<24>

Source§

fn from(value: Function) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> FromHex for FixedBytes<N>

Source§

type Error = FromHexError

Source§

fn from_hex<T: AsRef<[u8]>>(hex: T) -> Result<Self, Self::Error>

Creates an instance of type Self from the given hex string, or fails with a custom error type. Read more
Source§

impl<'a, const BITS: usize> FromSql<'a> for FixedBytes<BITS>

Available on crate feature postgres only.

Converts FixedBytes From Postgres Bytea Type.

Source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be created from the specified Postgres Type.
Source§

fn from_sql( _: &Type, raw: &'a [u8], ) -> Result<Self, Box<dyn Error + Sync + Send>>

Creates a new value of this type from a buffer of data of the specified Postgres Type in its binary format. Read more
Source§

fn from_sql_null(ty: &Type) -> Result<Self, Box<dyn Error + Sync + Send>>

Creates a new value of this type from a NULL SQL value. Read more
Source§

fn from_sql_nullable( ty: &Type, raw: Option<&'a [u8]>, ) -> Result<Self, Box<dyn Error + Sync + Send>>

A convenience function that delegates to from_sql and from_sql_null depending on the value of raw.
Source§

impl<const N: usize> FromStr for FixedBytes<N>

Source§

type Err = FromHexError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<const N: usize> Hash for FixedBytes<N>

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<__IdxT, const N: usize> Index<__IdxT> for FixedBytes<N>
where [u8; N]: Index<__IdxT>,

Source§

type Output = <[u8; N] as Index<__IdxT>>::Output

The returned type after indexing.
Source§

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

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

impl<__IdxT, const N: usize> IndexMut<__IdxT> for FixedBytes<N>
where [u8; N]: IndexMut<__IdxT>,

Source§

fn index_mut(&mut self, idx: __IdxT) -> &mut Self::Output

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

impl<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime FixedBytes<N>
where &'__deriveMoreLifetime [u8; N]: IntoIterator,

Source§

type Item = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <&'__deriveMoreLifetime [u8; N] as IntoIterator>::IntoIter

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<'__deriveMoreLifetime, const N: usize> IntoIterator for &'__deriveMoreLifetime mut FixedBytes<N>
where &'__deriveMoreLifetime mut [u8; N]: IntoIterator,

Source§

type Item = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <&'__deriveMoreLifetime mut [u8; N] as IntoIterator>::IntoIter

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<const N: usize> IntoIterator for FixedBytes<N>
where [u8; N]: IntoIterator,

Source§

type Item = <[u8; N] as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <[u8; N] as IntoIterator>::IntoIter

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<const N: usize> LowerHex for FixedBytes<N>

Source§

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

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

impl<const N: usize> MaxEncodedLenAssoc for FixedBytes<N>

Available on crate feature rlp only.
Source§

const LEN: usize = _

The maximum length.
Source§

impl<const N: usize> Not for FixedBytes<N>

Source§

type Output = FixedBytes<N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<const N: usize> Ord for FixedBytes<N>

Source§

fn cmp(&self, other: &FixedBytes<N>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

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

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

impl<const N: usize> PartialEq<&[u8]> for FixedBytes<N>

Source§

fn eq(&self, other: &&[u8]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<&[u8; N]> for FixedBytes<N>

Source§

fn eq(&self, other: &&[u8; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8]

Source§

fn eq(&self, other: &&FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<&FixedBytes<N>> for [u8; N]

Source§

fn eq(&self, other: &&FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<[u8]> for &FixedBytes<N>

Source§

fn eq(&self, other: &[u8]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<[u8]> for FixedBytes<N>

Source§

fn eq(&self, other: &[u8]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<[u8; N]> for &FixedBytes<N>

Source§

fn eq(&self, other: &[u8; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<[u8; N]> for FixedBytes<N>

Source§

fn eq(&self, other: &[u8; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8]

Source§

fn eq(&self, other: &FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<FixedBytes<N>> for &[u8; N]

Source§

fn eq(&self, other: &FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<FixedBytes<N>> for [u8]

Source§

fn eq(&self, other: &FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq<FixedBytes<N>> for [u8; N]

Source§

fn eq(&self, other: &FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialEq for FixedBytes<N>

Source§

fn eq(&self, other: &FixedBytes<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> PartialOrd<&[u8]> for FixedBytes<N>

Source§

fn partial_cmp(&self, other: &&[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> PartialOrd<&FixedBytes<N>> for [u8]

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> PartialOrd<[u8]> for &FixedBytes<N>

Source§

fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> PartialOrd<[u8]> for FixedBytes<N>

Source§

fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> PartialOrd<FixedBytes<N>> for &[u8]

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> PartialOrd<FixedBytes<N>> for [u8]

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> PartialOrd for FixedBytes<N>

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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<const N: usize> Serialize for FixedBytes<N>

Available on crate feature serde only.
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<const BITS: usize> ToSql for FixedBytes<BITS>

Available on crate feature postgres only.

Converts FixedBytes to Postgres Bytea Type.

Source§

fn to_sql( &self, _: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send + 'static>>

Converts the value of self into the binary format of the specified Postgres Type, appending it to out. Read more
Source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be converted to the specified Postgres Type.
Source§

fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>

An adaptor method used internally by Rust-Postgres. Read more
Source§

fn encode_format(&self, _ty: &Type) -> Format

Specify the encode format
Source§

impl<'a, const N: usize> TryFrom<&'a [u8]> for &'a FixedBytes<N>

Tries to create a ref FixedBytes<N> by copying from a slice &[u8]. Succeeds if slice.len() == N.

Source§

type Error = TryFromSliceError

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

fn try_from(slice: &'a [u8]) -> Result<&'a FixedBytes<N>, Self::Error>

Performs the conversion.
Source§

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

Tries to create a FixedBytes<N> by copying from a slice &[u8]. Succeeds if slice.len() == N.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl<'a, const N: usize> TryFrom<&'a mut [u8]> for &'a mut FixedBytes<N>

Tries to create a ref FixedBytes<N> by copying from a mutable slice &mut [u8]. Succeeds if slice.len() == N.

Source§

type Error = TryFromSliceError

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

fn try_from(slice: &'a mut [u8]) -> Result<&'a mut FixedBytes<N>, Self::Error>

Performs the conversion.
Source§

impl<const N: usize> TryFrom<&mut [u8]> for FixedBytes<N>

Tries to create a FixedBytes<N> by copying from a mutable slice &mut [u8]. Succeeds if slice.len() == N.

Source§

type Error = TryFromSliceError

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

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

Performs the conversion.
Source§

impl<const N: usize> UpperHex for FixedBytes<N>

Source§

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

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

impl<const N: usize> Copy for FixedBytes<N>

Source§

impl<const N: usize> Eq for FixedBytes<N>

Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<0>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<1>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<1024>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<128>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<16>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<2>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<20>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<256>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<32>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<4>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<512>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<64>

Available on crate feature rlp only.
Source§

impl MaxEncodedLen<{ $sz + length_of_length($sz) }> for FixedBytes<8>

Available on crate feature rlp only.
Source§

impl<const N: usize> StructuralPartialEq for FixedBytes<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for FixedBytes<N>

§

impl<const N: usize> RefUnwindSafe for FixedBytes<N>

§

impl<const N: usize> Send for FixedBytes<N>

§

impl<const N: usize> Sync for FixedBytes<N>

§

impl<const N: usize> Unpin for FixedBytes<N>

§

impl<const N: usize> UnwindSafe for FixedBytes<N>

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> BorrowToSql for T
where T: ToSql,

Source§

fn borrow_to_sql(&self) -> &dyn ToSql

Returns a reference to self as a ToSql trait object.
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

👎Deprecated: use ToHexExt instead
Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca).
Source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

👎Deprecated: use ToHexExt instead
Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA).
Source§

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

Source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
Source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
Source§

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

Source§

fn encode_hex(&self) -> String

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca).
Source§

fn encode_hex_upper(&self) -> String

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA).
Source§

fn encode_hex_with_prefix(&self) -> String

Encode the hex strict representing self into the result with prefix 0x. Lower case letters are used (e.g. 0xf9b4ca).
Source§

fn encode_hex_upper_with_prefix(&self) -> String

Encode the hex strict representing self into the result with prefix 0X. Upper case letters are used (e.g. 0xF9B4CA).
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> FromSqlOwned for T
where T: for<'a> FromSql<'a>,