Struct Bloom
#[repr(transparent)]pub struct Bloom(pub FixedBytes<256>);
Expand description
Ethereum 256 byte bloom filter.
Tuple Fields§
§0: FixedBytes<256>
Implementations§
§impl Bloom
impl Bloom
pub const fn with_last_byte(x: u8) -> Bloom
pub const fn with_last_byte(x: u8) -> Bloom
Creates a new byte array with the last byte set to x
.
pub const fn repeat_byte(byte: u8) -> Bloom
pub const fn repeat_byte(byte: u8) -> Bloom
Creates a new byte array where all bytes are set to byte
.
pub fn random() -> Bloom
pub fn random() -> Bloom
Instantiates a new fixed byte array with cryptographically random content.
§Panics
Panics if the underlying call to getrandom_uninit
fails.
pub fn try_random() -> Result<Bloom, Error>
pub fn try_random() -> Result<Bloom, Error>
Tries to create a new fixed byte array with cryptographically random content.
§Errors
This function only propagates the error from the underlying call to
getrandom_uninit
.
pub fn randomize(&mut self)
pub fn randomize(&mut self)
Fills this fixed byte array with cryptographically random content.
§Panics
Panics if the underlying call to getrandom_uninit
fails.
pub fn try_randomize(&mut self) -> Result<(), Error>
pub fn try_randomize(&mut self) -> Result<(), Error>
Tries to fill this fixed byte array with cryptographically random content.
§Errors
This function only propagates the error from the underlying call to
getrandom_uninit
.
pub fn random_with<R>(rng: &mut R) -> Bloom
pub fn random_with<R>(rng: &mut R) -> Bloom
Creates a new fixed byte array with the given random number generator.
pub fn randomize_with<R>(&mut self, rng: &mut R)
pub fn randomize_with<R>(&mut self, rng: &mut R)
Fills this fixed byte array with the given random number generator.
pub fn from_slice(src: &[u8]) -> Bloom
pub fn from_slice(src: &[u8]) -> Bloom
pub fn left_padding_from(value: &[u8]) -> Bloom
pub fn left_padding_from(value: &[u8]) -> Bloom
pub fn right_padding_from(value: &[u8]) -> Bloom
pub fn right_padding_from(value: &[u8]) -> Bloom
pub const fn into_array(self) -> [u8; 256]
pub const fn into_array(self) -> [u8; 256]
Returns the inner bytes array.
§impl Bloom
impl Bloom
pub fn contains_input(&self, input: BloomInput<'_>) -> bool
pub fn contains_input(&self, input: BloomInput<'_>) -> bool
Returns true if this bloom filter is a possible superset of the other bloom filter, admitting false positives.
Note: This method may return false positives. This is inherent to the bloom filter data structure.
pub const fn const_contains(self, other: Bloom) -> bool
pub const fn const_contains(self, other: Bloom) -> bool
Compile-time version of contains
.
Note: This method may return false positives. This is inherent to the bloom filter data structure.
pub fn contains(&self, other: &Bloom) -> bool
pub fn contains(&self, other: &Bloom) -> bool
Returns true if this bloom filter is a possible superset of the other bloom filter, admitting false positives.
Note: This method may return false positives. This is inherent to the bloom filter data structure.
pub fn accrue(&mut self, input: BloomInput<'_>)
pub fn accrue(&mut self, input: BloomInput<'_>)
Accrues the input into the bloom filter.
pub fn accrue_bloom(&mut self, bloom: &Bloom)
pub fn accrue_bloom(&mut self, bloom: &Bloom)
Accrues the input into the bloom filter.
pub fn m3_2048(&mut self, bytes: &[u8])
pub fn m3_2048(&mut self, bytes: &[u8])
Specialised Bloom filter that sets three bits out of 2048, given an arbitrary byte sequence.
See Section 4.3.1 “Transaction Receipt” of the Ethereum Yellow Paper (page 6).
pub fn m3_2048_hashed(&mut self, hash: &FixedBytes<32>)
pub fn m3_2048_hashed(&mut self, hash: &FixedBytes<32>)
m3_2048
but with a pre-hashed input.
pub fn accrue_raw_log(&mut self, address: Address, topics: &[FixedBytes<32>])
pub fn accrue_raw_log(&mut self, address: Address, topics: &[FixedBytes<32>])
Ingests a raw log into the bloom filter.
pub fn accrue_log(&mut self, log: &Log)
pub fn accrue_log(&mut self, log: &Log)
Ingests a log into the bloom filter.
pub fn contains_raw_log(
&self,
address: Address,
topics: &[FixedBytes<32>],
) -> bool
pub fn contains_raw_log( &self, address: Address, topics: &[FixedBytes<32>], ) -> bool
True if the bloom filter contains a log with given address and topics.
Note: This method may return false positives. This is inherent to the bloom filter data structure.
pub fn contains_log(&self, log: &Log) -> bool
pub fn contains_log(&self, log: &Log) -> bool
True if the bloom filter contains a log with given address and topics.
Note: This method may return false positives. This is inherent to the bloom filter data structure.
Methods from Deref<Target = FixedBytes<256>>§
pub const ZERO: FixedBytes<N> = _
pub fn randomize(&mut self)
Available on crate feature getrandom
only.
pub fn randomize(&mut self)
getrandom
only.Fills this FixedBytes
with cryptographically random content.
§Panics
Panics if the underlying call to
getrandom_uninit
fails.
pub fn try_randomize(&mut self) -> Result<(), Error>
Available on crate feature getrandom
only.
pub fn try_randomize(&mut self) -> Result<(), Error>
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
.
pub fn randomize_with<R>(&mut self, rng: &mut R)
Available on crate feature rand
only.
pub fn randomize_with<R>(&mut self, rng: &mut R)
rand
only.Fills this FixedBytes
with the given random number generator.
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice containing the entire array. Equivalent to
&mut s[..]
.
pub fn covers(&self, other: &FixedBytes<N>) -> bool
pub fn covers(&self, other: &FixedBytes<N>) -> bool
Returns true
if all bits set in self
are also set in b
.
pub fn const_eq(&self, other: &FixedBytes<N>) -> bool
pub fn const_eq(&self, other: &FixedBytes<N>) -> bool
Compile-time equality. NOT constant-time equality.
pub fn const_is_zero(&self) -> bool
pub fn const_is_zero(&self) -> bool
Returns true
if no bits are set.
Methods from Deref<Target = [u8; N]>§
Sourcepub fn as_ascii(&self) -> Option<&[AsciiChar; N]>
🔬This is a nightly-only experimental API. (ascii_char
)
pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>
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");
Sourcepub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]
🔬This is a nightly-only experimental API. (ascii_char
)
pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]
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 · Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Returns a slice containing the entire array. Equivalent to &s[..]
.
1.57.0 · Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable slice containing the entire array. Equivalent to
&mut s[..]
.
1.77.0 · Sourcepub fn each_ref(&self) -> [&T; N]
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 · Sourcepub fn each_mut(&mut self) -> [&mut T; N]
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]);
Sourcepub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
🔬This is a nightly-only experimental API. (split_array
)
pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
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, &[]);
}
Sourcepub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
🔬This is a nightly-only experimental API. (split_array
)
pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
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]);
Sourcepub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
🔬This is a nightly-only experimental API. (split_array
)
pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
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]);
}
Sourcepub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
🔬This is a nightly-only experimental API. (split_array
)
pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
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§
§impl<'a> Arbitrary<'a> for Bloom
impl<'a> Arbitrary<'a> for Bloom
§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Bloom, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Bloom, Error>
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Bloom, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Bloom, Error>
Self
from the entirety of the given
unstructured data. Read more§impl Arbitrary for Bloom
impl Arbitrary for Bloom
§type Parameters = <FixedBytes<256> as Arbitrary>::Parameters
type Parameters = <FixedBytes<256> as Arbitrary>::Parameters
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<<FixedBytes<256> as Arbitrary>::Strategy, fn(_: FixedBytes<256>) -> Bloom>
type Strategy = Map<<FixedBytes<256> as Arbitrary>::Strategy, fn(_: FixedBytes<256>) -> Bloom>
Strategy
used to generate values of type Self
.§impl AsMut<FixedBytes<256>> for Bloom
impl AsMut<FixedBytes<256>> for Bloom
§fn as_mut(&mut self) -> &mut FixedBytes<256>
fn as_mut(&mut self) -> &mut FixedBytes<256>
§impl AsRef<FixedBytes<256>> for Bloom
impl AsRef<FixedBytes<256>> for Bloom
§fn as_ref(&self) -> &FixedBytes<256>
fn as_ref(&self) -> &FixedBytes<256>
§impl BitAndAssign for Bloom
impl BitAndAssign for Bloom
§fn bitand_assign(&mut self, rhs: Bloom)
fn bitand_assign(&mut self, rhs: Bloom)
&=
operation. Read more§impl BitOrAssign for Bloom
impl BitOrAssign for Bloom
§fn bitor_assign(&mut self, rhs: Bloom)
fn bitor_assign(&mut self, rhs: Bloom)
|=
operation. Read more§impl BitXorAssign for Bloom
impl BitXorAssign for Bloom
§fn bitxor_assign(&mut self, rhs: Bloom)
fn bitxor_assign(&mut self, rhs: Bloom)
^=
operation. Read more§impl BorrowMut<[u8]> for &mut Bloom
impl BorrowMut<[u8]> for &mut Bloom
§fn borrow_mut(&mut self) -> &mut [u8] ⓘ
fn borrow_mut(&mut self) -> &mut [u8] ⓘ
§impl BorrowMut<[u8]> for Bloom
impl BorrowMut<[u8]> for Bloom
§fn borrow_mut(&mut self) -> &mut [u8] ⓘ
fn borrow_mut(&mut self) -> &mut [u8] ⓘ
§impl BorrowMut<[u8; 256]> for &mut Bloom
impl BorrowMut<[u8; 256]> for &mut Bloom
§fn borrow_mut(&mut self) -> &mut [u8; 256]
fn borrow_mut(&mut self) -> &mut [u8; 256]
§impl BorrowMut<[u8; 256]> for Bloom
impl BorrowMut<[u8; 256]> for Bloom
§fn borrow_mut(&mut self) -> &mut [u8; 256]
fn borrow_mut(&mut self) -> &mut [u8; 256]
§impl<'de> Deserialize<'de> for Bloom
impl<'de> Deserialize<'de> for Bloom
§fn deserialize<D>(
deserializer: D,
) -> Result<Bloom, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Bloom, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Distribution<Bloom> for Standard
impl Distribution<Bloom> for Standard
§impl<'a> Extend<&'a (Address, LogData)> for Bloom
impl<'a> Extend<&'a (Address, LogData)> for Bloom
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl<'a, 'b> Extend<&'a BloomInput<'b>> for Bloom
impl<'a, 'b> Extend<&'a BloomInput<'b>> for Bloom
§fn extend<T>(&mut self, inputs: T)where
T: IntoIterator<Item = &'a BloomInput<'b>>,
fn extend<T>(&mut self, inputs: T)where
T: IntoIterator<Item = &'a BloomInput<'b>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl<'a> Extend<&'a Log> for Bloom
impl<'a> Extend<&'a Log> for Bloom
§fn extend<T>(&mut self, logs: T)where
T: IntoIterator<Item = &'a Log>,
fn extend<T>(&mut self, logs: T)where
T: IntoIterator<Item = &'a Log>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl From<Bloom> for FixedBytes<256>
impl From<Bloom> for FixedBytes<256>
§fn from(value: Bloom) -> FixedBytes<256>
fn from(value: Bloom) -> FixedBytes<256>
§impl From<BloomInput<'_>> for Bloom
impl From<BloomInput<'_>> for Bloom
§fn from(input: BloomInput<'_>) -> Bloom
fn from(input: BloomInput<'_>) -> Bloom
§impl From<FixedBytes<256>> for Bloom
impl From<FixedBytes<256>> for Bloom
§fn from(value: FixedBytes<256>) -> Bloom
fn from(value: FixedBytes<256>) -> Bloom
§impl<'a> FromIterator<&'a (Address, LogData)> for Bloom
impl<'a> FromIterator<&'a (Address, LogData)> for Bloom
§impl<'a, 'b> FromIterator<&'a BloomInput<'b>> for Bloom
impl<'a, 'b> FromIterator<&'a BloomInput<'b>> for Bloom
§fn from_iter<T>(inputs: T) -> Bloomwhere
T: IntoIterator<Item = &'a BloomInput<'b>>,
fn from_iter<T>(inputs: T) -> Bloomwhere
T: IntoIterator<Item = &'a BloomInput<'b>>,
§impl<'a> FromIterator<&'a Log> for Bloom
impl<'a> FromIterator<&'a Log> for Bloom
§impl<__IdxT> Index<__IdxT> for Bloomwhere
FixedBytes<256>: Index<__IdxT>,
impl<__IdxT> Index<__IdxT> for Bloomwhere
FixedBytes<256>: Index<__IdxT>,
§impl<__IdxT> IndexMut<__IdxT> for Bloomwhere
FixedBytes<256>: IndexMut<__IdxT>,
impl<__IdxT> IndexMut<__IdxT> for Bloomwhere
FixedBytes<256>: IndexMut<__IdxT>,
§impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime Bloomwhere
&'__deriveMoreLifetime FixedBytes<256>: IntoIterator,
impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime Bloomwhere
&'__deriveMoreLifetime FixedBytes<256>: IntoIterator,
§type Item = <&'__deriveMoreLifetime FixedBytes<256> as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime FixedBytes<256> as IntoIterator>::Item
§type IntoIter = <&'__deriveMoreLifetime FixedBytes<256> as IntoIterator>::IntoIter
type IntoIter = <&'__deriveMoreLifetime FixedBytes<256> as IntoIterator>::IntoIter
§impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime mut Bloomwhere
&'__deriveMoreLifetime mut FixedBytes<256>: IntoIterator,
impl<'__deriveMoreLifetime> IntoIterator for &'__deriveMoreLifetime mut Bloomwhere
&'__deriveMoreLifetime mut FixedBytes<256>: IntoIterator,
§type Item = <&'__deriveMoreLifetime mut FixedBytes<256> as IntoIterator>::Item
type Item = <&'__deriveMoreLifetime mut FixedBytes<256> as IntoIterator>::Item
§type IntoIter = <&'__deriveMoreLifetime mut FixedBytes<256> as IntoIterator>::IntoIter
type IntoIter = <&'__deriveMoreLifetime mut FixedBytes<256> as IntoIterator>::IntoIter
§impl IntoIterator for Bloomwhere
FixedBytes<256>: IntoIterator,
impl IntoIterator for Bloomwhere
FixedBytes<256>: IntoIterator,
§type Item = <FixedBytes<256> as IntoIterator>::Item
type Item = <FixedBytes<256> as IntoIterator>::Item
§type IntoIter = <FixedBytes<256> as IntoIterator>::IntoIter
type IntoIter = <FixedBytes<256> as IntoIterator>::IntoIter
§impl Ord for Bloom
impl Ord for Bloom
§impl PartialOrd<&[u8]> for Bloom
impl PartialOrd<&[u8]> for Bloom
§impl PartialOrd<&Bloom> for [u8]
impl PartialOrd<&Bloom> for [u8]
§impl PartialOrd<[u8]> for &Bloom
impl PartialOrd<[u8]> for &Bloom
§impl PartialOrd<[u8]> for Bloom
impl PartialOrd<[u8]> for Bloom
§impl PartialOrd<Bloom> for &[u8]
impl PartialOrd<Bloom> for &[u8]
§impl PartialOrd<Bloom> for [u8]
impl PartialOrd<Bloom> for [u8]
§impl PartialOrd for Bloom
impl PartialOrd for Bloom
§impl Serialize for Bloom
impl Serialize for Bloom
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Copy for Bloom
impl Eq for Bloom
impl MaxEncodedLen<alloy_primitives::::bits::bloom::{impl#94}::{constant#0}> for Bloom
impl StructuralPartialEq for Bloom
Auto Trait Implementations§
impl Freeze for Bloom
impl RefUnwindSafe for Bloom
impl Send for Bloom
impl Sync for Bloom
impl Unpin for Bloom
impl UnwindSafe for Bloom
Blanket Implementations§
§impl<A, T> AsMutBits<T> for A
impl<A, T> AsMutBits<T> for A
§fn as_mut_bits<O>(&mut self) -> &mut BitSlice<T, O> ⓘwhere
O: BitOrder,
fn as_mut_bits<O>(&mut self) -> &mut BitSlice<T, O> ⓘwhere
O: BitOrder,
self
as a mutable bit-slice region with the O
ordering.§fn try_as_mut_bits<O>(&mut self) -> Result<&mut BitSlice<T, O>, BitSpanError<T>>where
O: BitOrder,
fn try_as_mut_bits<O>(&mut self) -> Result<&mut BitSlice<T, O>, BitSpanError<T>>where
O: BitOrder,
§impl<T> Base32Len for T
impl<T> Base32Len for T
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
§impl<I> BidiIterator for I
impl<I> BidiIterator for I
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.§impl<T> ToBase32 for T
impl<T> ToBase32 for T
§impl<T> ToHex for T
impl<T> ToHex for T
§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt
insteadself
into the result.
Lower case letters are used (e.g. f9b4ca
).§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt
insteadself
into the result.
Upper case letters are used (e.g. F9B4CA
).Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)§impl<T> ToHexExt for T
impl<T> ToHexExt for T
§fn encode_hex(&self) -> String
fn encode_hex(&self) -> String
self
into the result.
Lower case letters are used (e.g. f9b4ca
).§fn encode_hex_upper(&self) -> String
fn encode_hex_upper(&self) -> String
self
into the result.
Upper case letters are used (e.g. F9B4CA
).§fn encode_hex_with_prefix(&self) -> String
fn encode_hex_with_prefix(&self) -> String
self
into the result with prefix 0x
.
Lower case letters are used (e.g. 0xf9b4ca
).§fn encode_hex_upper_with_prefix(&self) -> String
fn encode_hex_upper_with_prefix(&self) -> String
self
into the result with prefix 0X
.
Upper case letters are used (e.g. 0xF9B4CA
).§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> NumBytes for T
impl<T> RpcObject for Twhere
T: RpcParam + RpcReturn,
impl<T> RpcParam for T
impl<T> RpcReturn for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 256 bytes