pub struct AllocationId(/* private fields */);
Expand description
A unique identifier for an allocation: the allocation’s Ethereum address.
This is a “new-type” wrapper around Address
to provide type safety.
§Formatting
The AllocationId
type implements the following formatting traits:
- Use
std::fmt::Display
for formatting theAllocationId
as an EIP-55 checksum string. - Use
std::fmt::LowerHex
(orstd::fmt::UpperHex
) for formatting theAllocationId
as a hexadecimal string.
See the Display
, LowerHex
, and UpperHex
trait implementations for usage examples.
§Generating test data
The AllocationId
type implements the fake
crate’s fake::Dummy
trait, allowing you to
generate random AllocationId
values for testing.
Note that the fake
feature must be enabled to use this functionality.
See the Dummy
trait impl for usage examples.
Implementations§
Source§impl AllocationId
impl AllocationId
Sourcepub const fn new(address: Address) -> Self
pub const fn new(address: Address) -> Self
Create a new AllocationId
.
Sourcepub fn into_inner(self) -> Address
pub fn into_inner(self) -> Address
Return the internal representation.
Methods from Deref<Target = Address>§
pub const ZERO: Address
Sourcepub fn covers(&self, b: &Address) -> bool
pub fn covers(&self, b: &Address) -> bool
Returns true
if all bits set in b
are also set in self
.
Sourcepub fn const_eq(&self, other: &Address) -> bool
pub fn const_eq(&self, other: &Address) -> bool
Compile-time equality. NOT constant-time equality.
Sourcepub fn into_word(&self) -> FixedBytes<32>
pub fn into_word(&self) -> FixedBytes<32>
Left-pads the address to 32 bytes (EVM word size).
§Examples
assert_eq!(
address!("0xd8da6bf26964af9d7eed9e03e53415d37aa96045").into_word(),
b256!("0x000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045"),
);
Sourcepub fn to_checksum(&self, chain_id: Option<u64>) -> String
pub fn to_checksum(&self, chain_id: Option<u64>) -> String
Encodes an Ethereum address to its EIP-55 checksum into a heap-allocated string.
You can optionally specify an EIP-155 chain ID to encode the address using EIP-1191.
§Examples
let address = address!("0xd8da6bf26964af9d7eed9e03e53415d37aa96045");
let checksummed: String = address.to_checksum(None);
assert_eq!(checksummed, "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
let checksummed: String = address.to_checksum(Some(1));
assert_eq!(checksummed, "0xD8Da6bf26964Af9d7EEd9e03e53415d37AA96045");
Sourcepub fn to_checksum_raw<'a>(
&self,
buf: &'a mut [u8],
chain_id: Option<u64>,
) -> &'a mut str
pub fn to_checksum_raw<'a>( &self, buf: &'a mut [u8], chain_id: Option<u64>, ) -> &'a mut str
Encodes an Ethereum address to its EIP-55 checksum into the given buffer.
For convenience, the buffer is returned as a &mut str
, as the bytes
are guaranteed to be valid UTF-8.
You can optionally specify an EIP-155 chain ID to encode the address using EIP-1191.
§Panics
Panics if buf
is not exactly 42 bytes long.
§Examples
let address = address!("0xd8da6bf26964af9d7eed9e03e53415d37aa96045");
let mut buf = [0; 42];
let checksummed: &mut str = address.to_checksum_raw(&mut buf, None);
assert_eq!(checksummed, "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
let checksummed: &mut str = address.to_checksum_raw(&mut buf, Some(1));
assert_eq!(checksummed, "0xD8Da6bf26964Af9d7EEd9e03e53415d37AA96045");
Sourcepub fn to_checksum_buffer(&self, chain_id: Option<u64>) -> AddressChecksumBuffer
pub fn to_checksum_buffer(&self, chain_id: Option<u64>) -> AddressChecksumBuffer
Encodes an Ethereum address to its EIP-55 checksum into a stack-allocated buffer.
You can optionally specify an EIP-155 chain ID to encode the address using EIP-1191.
§Examples
let address = address!("0xd8da6bf26964af9d7eed9e03e53415d37aa96045");
let mut buffer: AddressChecksumBuffer = address.to_checksum_buffer(None);
assert_eq!(buffer.as_str(), "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
let checksummed: &str = buffer.format(&address, Some(1));
assert_eq!(checksummed, "0xD8Da6bf26964Af9d7EEd9e03e53415d37AA96045");
Sourcepub fn create(&self, nonce: u64) -> Address
pub fn create(&self, nonce: u64) -> Address
Computes the create
address for this address and nonce:
keccak256(rlp([sender, nonce]))[12:]
§Examples
let sender = address!("0xb20a608c624Ca5003905aA834De7156C68b2E1d0");
let expected = address!("0x00000000219ab540356cBB839Cbe05303d7705Fa");
assert_eq!(sender.create(0), expected);
let expected = address!("0xe33c6e89e69d085897f98e92b06ebd541d1daa99");
assert_eq!(sender.create(1), expected);
Sourcepub fn create2_from_code<S, C>(&self, salt: S, init_code: C) -> Address
pub fn create2_from_code<S, C>(&self, salt: S, init_code: C) -> Address
Computes the CREATE2
address of a smart contract as specified in
EIP-1014:
keccak256(0xff ++ address ++ salt ++ keccak256(init_code))[12:]
The init_code
is the code that, when executed, produces the runtime
bytecode that will be placed into the state, and which typically is used
by high level languages to implement a ‘constructor’.
§Examples
let address = address!("0x8ba1f109551bD432803012645Ac136ddd64DBA72");
let salt = b256!("0x7c5ea36004851c764c44143b1dcb59679b11c9a68e5f41497f6cf3d480715331");
let init_code = bytes!("6394198df16000526103ff60206004601c335afa6040516060f3");
let expected = address!("0x533ae9d683B10C02EbDb05471642F85230071FC3");
assert_eq!(address.create2_from_code(salt, init_code), expected);
Sourcepub fn create2<S, H>(&self, salt: S, init_code_hash: H) -> Address
pub fn create2<S, H>(&self, salt: S, init_code_hash: H) -> Address
Computes the CREATE2
address of a smart contract as specified in
EIP-1014, taking the pre-computed hash of the init code as input:
keccak256(0xff ++ address ++ salt ++ init_code_hash)[12:]
The init_code
is the code that, when executed, produces the runtime
bytecode that will be placed into the state, and which typically is used
by high level languages to implement a ‘constructor’.
§Examples
let address = address!("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f");
let salt = b256!("0x2b2f5776e38002e0c013d0d89828fdb06fee595ea2d5ed4b194e3883e823e350");
let init_code_hash =
b256!("0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f");
let expected = address!("0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852");
assert_eq!(address.create2(salt, init_code_hash), expected);
Sourcepub fn create_eof<S>(&self, salt: S) -> Address
pub fn create_eof<S>(&self, salt: S) -> Address
Computes the address created by the EOFCREATE
opcode, where self
is the sender.
The address is calculated as keccak256(0xff || sender32 || salt)[12:]
, where sender32 is
the sender address left-padded to 32 bytes with zeros.
See EIP-7620 for more details.
§Examples
let address = address!("0xb20a608c624Ca5003905aA834De7156C68b2E1d0");
let salt = b256!("0x7c5ea36004851c764c44143b1dcb59679b11c9a68e5f41497f6cf3d480715331");
// Create an address using CREATE_EOF
let eof_address = address.create_eof(salt);
Methods from Deref<Target = FixedBytes<20>>§
pub const ZERO: FixedBytes<N>
Sourcepub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_slice(&self) -> &[u8] ⓘ
Returns a slice containing the entire array. Equivalent to &s[..]
.
Sourcepub 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[..]
.
Sourcepub 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
.
Sourcepub fn const_eq(&self, other: &FixedBytes<N>) -> bool
pub fn const_eq(&self, other: &FixedBytes<N>) -> bool
Compile-time equality. NOT constant-time equality.
Sourcepub 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§
Source§impl AsRef<Address> for AllocationId
impl AsRef<Address> for AllocationId
Source§impl Clone for AllocationId
impl Clone for AllocationId
Source§fn clone(&self) -> AllocationId
fn clone(&self) -> AllocationId
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for AllocationId
impl Debug for AllocationId
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the AllocationId
using its raw lower-case hexadecimal representation.
It is advised to use the LowerHex
(and UpperHex
) format trait implementation over
the Debug
implementation to format the AllocationId
as a lower-case
hexadecimal string.
This implementation matches alloy_primitives::Address
’s Debug
implementation.
const ID: AllocationId = allocation_id!("0002c67268fb8c8917f36f865a0cbdf5292fa68d");
assert_eq!(format!("{:?}", ID), "0x0002c67268fb8c8917f36f865a0cbdf5292fa68d");
Source§impl Deref for AllocationId
impl Deref for AllocationId
Source§impl<'de> Deserialize<'de> for AllocationId
impl<'de> Deserialize<'de> for AllocationId
Source§fn deserialize<D>(deserializer: D) -> Result<AllocationId, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<AllocationId, D::Error>where
D: Deserializer<'de>,
Source§impl Display for AllocationId
impl Display for AllocationId
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the AllocationId
using its EIP-55
checksum representation.
See LowerHex
(and UpperHex
) for formatting the AllocationId
as a hexadecimal
string.
const ID: AllocationId = allocation_id!("0002c67268fb8c8917f36f865a0cbdf5292fa68d");
// Note the uppercase and lowercase hex characters in the checksum
assert_eq!(format!("{}", ID), "0x0002c67268FB8C8917F36F865a0CbdF5292FA68d");
Source§impl Dummy<Faker> for AllocationId
To use the fake
crate to generate random AllocationId
values, the fake
feature must
be enabled.
impl Dummy<Faker> for AllocationId
To use the fake
crate to generate random AllocationId
values, the fake
feature must
be enabled.
let allocation_id = fake::Faker.fake::<AllocationId>();
println!("AllocationId: {:#x}", allocation_id);
Source§impl From<Address> for AllocationId
impl From<Address> for AllocationId
Source§impl From<AllocationId> for CollectionId
Convert an AllocationId
into a CollectionId
by zero padding the allocation id to 32 bytes.
impl From<AllocationId> for CollectionId
Convert an AllocationId
into a CollectionId
by zero padding the allocation id to 32 bytes.
use thegraph_core::{
alloy::primitives::Address,
alloy::primitives::address,
collection_id, CollectionId,
allocation_id, AllocationId
};
let allocation_id: AllocationId = allocation_id!("3e1f9c2aB4C7F1b3d7E839EbE6Ae451c8A0b1d24");
let collection_id: CollectionId = allocation_id.into();
assert_eq!(format!("{:?}", collection_id), "0x0000000000000000000000003e1f9c2ab4c7f1b3d7e839ebe6ae451c8a0b1d24");
let collection_id2: CollectionId = CollectionId::from(allocation_id!("3e1f9c2aB4C7F1b3d7E839EbE6Ae451c8A0b1d24"));
assert_eq!(format!("{:?}", collection_id2), "0x0000000000000000000000003e1f9c2ab4c7f1b3d7e839ebe6ae451c8a0b1d24");
Source§fn from(allocation: AllocationId) -> Self
fn from(allocation: AllocationId) -> Self
Source§impl From<CollectionId> for AllocationId
Convert a CollectionId
into an AllocationId
by truncating to the last 20 bytes.
impl From<CollectionId> for AllocationId
Convert a CollectionId
into an AllocationId
by truncating to the last 20 bytes.
use thegraph_core::{
alloy::primitives::Address,
alloy::primitives::address,
collection_id, CollectionId,
allocation_id, AllocationId
};
let collection_id: CollectionId = collection_id!("0000000000000000000000003e1f9c2ab4c7f1b3d7e839ebe6ae451c8a0b1d24");
let allocation_id: AllocationId = collection_id.into();
assert_eq!(format!("{:?}", allocation_id), "0x3e1f9c2ab4c7f1b3d7e839ebe6ae451c8a0b1d24");
let allocation_id2: AllocationId = AllocationId::from(collection_id!("0000000000000000000000003e1f9c2ab4c7f1b3d7e839ebe6ae451c8a0b1d24"));
assert_eq!(format!("{:?}", allocation_id2), "0x3e1f9c2ab4c7f1b3d7e839ebe6ae451c8a0b1d24");
Source§fn from(collection_id: CollectionId) -> Self
fn from(collection_id: CollectionId) -> Self
Source§impl FromStr for AllocationId
impl FromStr for AllocationId
Source§impl Hash for AllocationId
impl Hash for AllocationId
Source§impl LowerHex for AllocationId
impl LowerHex for AllocationId
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Lowercase hex representation of the AllocationId
.
Note that the alternate flag, #
, adds a 0x
in front of the output.
const ID: AllocationId = allocation_id!("0002c67268fb8c8917f36f865a0cbdf5292fa68d");
// Lower hex
assert_eq!(format!("{:x}", ID), "0002c67268fb8c8917f36f865a0cbdf5292fa68d");
// Lower hex with alternate flag
assert_eq!(format!("{:#x}", ID), "0x0002c67268fb8c8917f36f865a0cbdf5292fa68d");
Source§impl Ord for AllocationId
impl Ord for AllocationId
Source§fn cmp(&self, other: &AllocationId) -> Ordering
fn cmp(&self, other: &AllocationId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<Address> for AllocationId
impl PartialEq<Address> for AllocationId
Source§impl PartialEq for AllocationId
impl PartialEq for AllocationId
Source§impl PartialOrd for AllocationId
impl PartialOrd for AllocationId
Source§impl Serialize for AllocationId
impl Serialize for AllocationId
Source§impl UpperHex for AllocationId
impl UpperHex for AllocationId
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Uppercase hex representation of the AllocationId
.
Note that the alternate flag, #
, adds a 0x
in front of the output.
const ID: AllocationId = allocation_id!("0002c67268fb8c8917f36f865a0cbdf5292fa68d");
// Upper hex
assert_eq!(format!("{:X}", ID), "0002C67268FB8C8917F36F865A0CBDF5292FA68D");
// Upper hex with alternate flag
assert_eq!(format!("{:#X}", ID), "0x0002C67268FB8C8917F36F865A0CBDF5292FA68D");
impl Copy for AllocationId
impl Eq for AllocationId
impl StructuralPartialEq for AllocationId
Auto Trait Implementations§
impl Freeze for AllocationId
impl RefUnwindSafe for AllocationId
impl Send for AllocationId
impl Sync for AllocationId
impl Unpin for AllocationId
impl UnwindSafe for AllocationId
Blanket Implementations§
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§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 moreSource§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 moreSource§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
Source§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
Source§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.Source§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.Source§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.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.