pub struct AliasAddress(/* private fields */);
Expand description

An alias address.

Implementations§

source§

impl AliasAddress

source

pub const KIND: u8 = 8u8

The Address kind of an AliasAddress.

source

pub const LENGTH: usize = 32usize

The length of an AliasAddress.

source

pub fn new(id: AliasId) -> AliasAddress

Creates a new AliasAddress.

source

pub fn alias_id(&self) -> &AliasId

Returns the AliasId of an AliasAddress.

source

pub fn into_alias_id(self) -> AliasId

Consumes an AliasAddress and returns its AliasId.

Methods from Deref<Target = AliasId>§

source

pub const LENGTH: usize = 32usize

source

pub fn is_null(&self) -> bool

Checks if the [$ty] is null.

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

1.57.0 · source

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

Returns a slice containing the entire array. Equivalent to &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);
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 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 as_ascii(&self) -> Option<&[AsciiChar; N]>

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

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

§Examples
#![feature(ascii_char)]
#![feature(const_option)]

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 a 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.

Trait Implementations§

source§

impl<__AsRefT> AsRef<__AsRefT> for AliasAddress
where AliasId: AsRef<__AsRefT>, __AsRefT: ?Sized,

source§

fn as_ref(&self) -> &__AsRefT

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

impl Clone for AliasAddress

source§

fn clone(&self) -> AliasAddress

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 Debug for AliasAddress

source§

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

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

impl Deref for AliasAddress

§

type Target = AliasId

The resulting type after dereferencing.
source§

fn deref(&self) -> &<AliasAddress as Deref>::Target

Dereferences the value.
source§

impl<'de> Deserialize<'de> for AliasAddress

source§

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

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

impl Display for AliasAddress

source§

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

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

impl From<&AliasAddress> for AliasAddressDto

source§

fn from(value: &AliasAddress) -> AliasAddressDto

Converts to this type from the input type.
source§

impl From<&OutputId> for AliasAddress

source§

fn from(output_id: &OutputId) -> AliasAddress

Converts to this type from the input type.
source§

impl From<AliasAddress> for Address

source§

fn from(original: AliasAddress) -> Address

Converts to this type from the input type.
source§

impl From<AliasId> for AliasAddress

source§

fn from(original: AliasId) -> AliasAddress

Converts to this type from the input type.
source§

impl FromStr for AliasAddress

§

type Err = Error

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

fn from_str(s: &str) -> Result<AliasAddress, <AliasAddress as FromStr>::Err>

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

impl Hash for AliasAddress

source§

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

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 Ord for AliasAddress

source§

fn cmp(&self, other: &AliasAddress) -> 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 + PartialOrd,

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

impl Packable for AliasAddress

§

type UnpackError = <AliasId as Packable>::UnpackError

The error type that can be returned if some semantic error occurs while unpacking. Read more
§

type UnpackVisitor = <AliasId as Packable>::UnpackVisitor

FIXME: docs
source§

fn pack<P>(&self, packer: &mut P) -> Result<(), <P as Packer>::Error>
where P: Packer,

Packs this value into the given Packer.
source§

fn unpack<U, const VERIFY: bool>( unpacker: &mut U, visitor: &<AliasAddress as Packable>::UnpackVisitor ) -> Result<AliasAddress, UnpackError<<AliasAddress as Packable>::UnpackError, <U as Unpacker>::Error>>
where U: Unpacker,

Unpacks this value from the given Unpacker. The VERIFY generic parameter can be used to skip additional syntactic checks.
source§

impl PartialEq for AliasAddress

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for AliasAddress

source§

fn partial_cmp(&self, other: &AliasAddress) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for AliasAddress

source§

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

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

impl TryFrom<AliasAddressDto> for AliasAddress

§

type Error = Error

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

fn try_from( value: AliasAddressDto ) -> Result<AliasAddress, <AliasAddress as TryFrom<AliasAddressDto>>::Error>

Performs the conversion.
source§

impl Copy for AliasAddress

source§

impl Eq for AliasAddress

source§

impl StructuralPartialEq for AliasAddress

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn base32_len(&self) -> usize

Calculate the base32 serialized length
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> CheckBase32<Vec<u5>> for T
where T: AsRef<[u8]>,

§

type Err = Error

Error type if conversion fails
source§

fn check_base32(self) -> Result<Vec<u5>, <T as CheckBase32<Vec<u5>>>::Err>

Check if all values are in range and return array-like struct of u5 values
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<T> ConvertTo<T> for T
where T: Send,

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> FmtJson for T
where T: ToJson,

source§

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

Format this as a JSON string or pretty-JSON string based on whether the # format flag was used.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>

Deserialize Self from a string of JSON text.
source§

fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>

Deserialize Self from bytes of JSON text.
source§

fn from_json_value(json: Value) -> Result<Self, Error>

Deserialize Self from a serde_json::Value.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<P> PackableExt for P
where P: Packable,

source§

fn unpack_verified<T>( bytes: T, visitor: &<P as Packable>::UnpackVisitor ) -> Result<P, UnpackError<<P as Packable>::UnpackError, UnexpectedEOF>>
where T: AsRef<[u8]>,

Unpacks this value from a type that implements [AsRef<[u8]>].

source§

fn unpack_unverified<T>( bytes: T ) -> Result<P, UnpackError<<P as Packable>::UnpackError, UnexpectedEOF>>
where T: AsRef<[u8]>,

Unpacks this value from a type that implements [AsRef<[u8]>] skipping some syntatical checks.

source§

fn packed_len(&self) -> usize

Returns the length in bytes of the value after being packed. The returned value always matches the number of bytes written using pack.
source§

fn pack_to_vec(&self) -> Vec<u8>

Convenience method that packs this value into a Vec<u8>.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

source§

fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>
where W: WriteBase32,

Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate.
source§

fn to_base32(&self) -> Vec<u5>

Convert Self to base32 vector
source§

impl<T> ToBech32Ext for T
where T: Into<Address>,

source§

fn try_to_bech32(self, hrp: impl ConvertTo<Hrp>) -> Result<Bech32Address, Error>

Try to encode this address to a bech32 string with the given Human Readable Part as prefix.

source§

fn to_bech32(self, hrp: Hrp) -> Bech32Address

Encodes this address to a bech32 string with the given Human Readable Part as prefix.

source§

fn to_bech32_unchecked(self, hrp: impl ConvertTo<Hrp>) -> Bech32Address

Encodes this address to a bech32 string with the given Human Readable Part as prefix without checking validity.

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> ToJson for T
where T: Serialize,

source§

fn to_json(&self) -> Result<String, Error>

Serialize self as a string of JSON.
source§

fn to_json_vec(&self) -> Result<Vec<u8>, Error>

Serialize self as a JSON byte vector.
source§

fn to_json_value(&self) -> Result<Value, Error>

Serialize self as a serde_json::Value.
source§

fn to_json_pretty(&self) -> Result<String, Error>

Serialize self as a pretty-printed string of JSON.
source§

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

§

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>,

§

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>,

§

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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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