Skip to main content

AccountIdRef

Struct AccountIdRef 

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

Account identifier. This is the human readable UTF-8 string which is used internally to index accounts on the network and their respective state.

This is the “referenced” version of the account ID. It is to AccountId what str is to String, and works quite similarly to Path. Like with str and Path, you can’t have a value of type AccountIdRef, but you can have a reference like &AccountIdRef or &mut AccountIdRef.

This type supports zero-copy deserialization offered by serde, but cannot do the same for borsh since the latter does not support zero-copy.

§Examples

use near_account_id::{AccountId, AccountIdRef};
use std::convert::{TryFrom, TryInto};

// Construction
let alice = AccountIdRef::new("alice.near").unwrap();
assert!(AccountIdRef::new("invalid.").is_err());

Implementations§

§

impl AccountIdRef

pub const MIN_LEN: usize = crate::validation::MIN_LEN

Shortest valid length for a NEAR Account ID.

pub const MAX_LEN: usize = crate::validation::MAX_LEN

Longest valid length for a NEAR Account ID.

pub fn new<S>(id: &S) -> Result<&AccountIdRef, ParseAccountError>
where S: AsRef<str> + ?Sized,

Construct a &AccountIdRef from a string reference.

This constructor validates the provided ID, and will produce an error when validation fails.

pub const fn new_or_panic(id: &str) -> &AccountIdRef

Construct a &AccountIdRef from with validation at compile time. This constructor will panic if validation fails.

use near_account_id::AccountIdRef;
const ALICE: &AccountIdRef = AccountIdRef::new_or_panic("alice.near");

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

Returns a reference to the account ID bytes.

pub fn as_str(&self) -> &str

Returns a string slice of the entire Account ID.

§Examples
use near_account_id::AccountIdRef;

let carol = AccountIdRef::new("carol.near").unwrap();
assert_eq!("carol.near", carol.as_str());

pub fn is_top_level(&self) -> bool

Returns true if the account ID is a top-level NEAR Account ID.

See Top-level Accounts.

§Examples
use near_account_id::AccountIdRef;

let near_tla = AccountIdRef::new("near").unwrap();
assert!(near_tla.is_top_level());

// "alice.near" is a sub account of "near" account
let alice = AccountIdRef::new("alice.near").unwrap();
assert!(!alice.is_top_level());

pub fn sub_account( &self, name: impl AsRef<str>, ) -> Result<AccountId, ParseAccountError>

Returns sub account of current account: {name}.{parent}.

Returns Err if the resulting sub account is invalid (e.g. too long).

§Examples
use near_account_id::AccountIdRef;

let parent = AccountIdRef::new("near").unwrap();
let child = parent.sub_account("alice").unwrap();

assert!(child.is_sub_account_of(parent));

pub fn parent(&self) -> Option<&AccountIdRef>

Returns parent account if current account is a subaccount.

§Examples
use near_account_id::AccountIdRef;

let tla = AccountIdRef::new("near").unwrap();
assert_eq!(tla.parent(), None);

let child = AccountIdRef::new("alice.near").unwrap();
let parent = child.parent().unwrap();

assert_eq!(parent, "near");
assert!(child.is_sub_account_of(parent));

pub fn is_sub_account_of(&self, parent: impl AsRef<AccountIdRef>) -> bool

Returns true if the AccountId is a direct sub-account of the provided parent account.

See Subaccounts.

§Examples
use near_account_id::AccountId;

let near_tla: AccountId = "near".parse().unwrap();
assert!(near_tla.is_top_level());

let alice: AccountId = "alice.near".parse().unwrap();
assert!(alice.is_sub_account_of(&near_tla));

let alice_app: AccountId = "app.alice.near".parse().unwrap();

// While app.alice.near is a sub account of alice.near,
// app.alice.near is not a sub account of near
assert!(alice_app.is_sub_account_of(&alice));
assert!(!alice_app.is_sub_account_of(&near_tla));

pub fn get_account_type(&self) -> AccountType

Returns AccountType::EthImplicitAccount if the AccountId is a 40 characters long hexadecimal prefixed with ‘0x’. Returns AccountType::NearImplicitAccount if the AccountId is a 64 characters long hexadecimal. Otherwise, returns AccountType::NamedAccount.

See Implicit-Accounts.

§Examples
use near_account_id::{AccountId, AccountType};

let alice: AccountId = "alice.near".parse().unwrap();
assert!(alice.get_account_type() == AccountType::NamedAccount);

let eth_rando = "0xb794f5ea0ba39494ce839613fffba74279579268"
    .parse::<AccountId>()
    .unwrap();
assert!(eth_rando.get_account_type() == AccountType::EthImplicitAccount);

let near_rando = "98793cd91a3f870fb126f66285808c7e094afcfc4eda8a970f6648cdf0dbd6de"
    .parse::<AccountId>()
    .unwrap();
assert!(near_rando.get_account_type() == AccountType::NearImplicitAccount);

pub fn is_system(&self) -> bool

Returns true if this AccountId is the system account.

See System account.

§Examples
use near_account_id::AccountId;

let alice: AccountId = "alice.near".parse().unwrap();
assert!(!alice.is_system());

let system: AccountId = "system".parse().unwrap();
assert!(system.is_system());

pub const fn len(&self) -> usize

Returns the length of the underlying account id string.

pub fn get_parent_account_id(&self) -> Option<&AccountIdRef>

Returns parent’s account id reference

§Examples
use near_account_id::AccountIdRef;

let alice: &AccountIdRef = AccountIdRef::new_or_panic("alice.near");
let parent: &AccountIdRef = alice.get_parent_account_id().unwrap();

assert!(alice.is_sub_account_of(parent));

let near: &AccountIdRef = AccountIdRef::new_or_panic("near");

assert!(near.get_parent_account_id().is_none());

let implicit: &AccountIdRef = AccountIdRef::new_or_panic("248e104d1d4764d713c4211c13808c8fc887869c580f4178e60538ac5c2a0b26");

assert!(implicit.get_parent_account_id().is_none());

Trait Implementations§

§

impl AccountIdExt for AccountIdRef

§

fn is_implicit(&self) -> bool

Check if this is a NEAR-implicit account (64 hex chars).
§

fn is_evm_implicit(&self) -> bool

Check if this is an EVM implicit account (0x prefix + 40 hex chars).
§

fn is_named(&self) -> bool

Check if this is a named account (not implicit, not EVM implicit).
§

impl<'a> Arbitrary<'a> for &'a AccountIdRef

Available on crate feature arbitrary only.
§

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
§

fn arbitrary(u: &mut Unstructured<'a>) -> Result<&'a AccountIdRef, Error>

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

fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<&'a AccountIdRef, Error>

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

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
§

impl AsRef<AccountIdRef> for AccountId

§

fn as_ref(&self) -> &AccountIdRef

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

impl AsRef<AccountIdRef> for AccountIdRef

fn foo(account_id: impl AsRef<AccountIdRef>) {}

let account_id: AccountId = "alice.near".parse().unwrap();
let account_id_ref: &AccountIdRef = account_id.as_ref();

foo(account_id_ref);
foo(account_id);
§

fn as_ref(&self) -> &AccountIdRef

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

impl AsRef<str> for AccountIdRef

§

fn as_ref(&self) -> &str

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

impl Borrow<AccountIdRef> for AccountId

§

fn borrow(&self) -> &AccountIdRef

Immutably borrows from an owned value. Read more
§

impl BorshSchema for AccountIdRef

§

fn declaration() -> String

Get the name of the type without brackets.
§

fn add_definitions_recursively(definitions: &mut BTreeMap<String, Definition>)

Recursively, using DFS, add type definitions required for this type. Type definition partially explains how to serialize/deserialize a type.
§

impl BorshSerialize for AccountIdRef

§

fn serialize<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

§

impl Debug for AccountIdRef

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for &'de AccountIdRef

§

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

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

impl Display for AccountIdRef

§

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

Formats the value using the given formatter. Read more
§

impl<'a> From<&'a AccountIdRef> for AccountId

§

fn from(id: &'a AccountIdRef) -> AccountId

Converts to this type from the input type.
§

impl Hash for AccountIdRef

§

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

Feeds this value into the given Hasher. Read more
§

impl JsonSchema for AccountIdRef

Available on crate feature schemars-v0_8 only.
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
§

fn json_schema(_: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
§

impl Ord for AccountIdRef

§

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

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

impl<'a> PartialEq<&'a AccountIdRef> for AccountId

§

fn eq(&self, other: &&'a AccountIdRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialEq<&'a AccountIdRef> for str

§

fn eq(&self, other: &&'a AccountIdRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialEq<&'a str> for AccountIdRef

§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialEq<AccountId> for &'a AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq<AccountId> for AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialEq<AccountIdRef> for &'a str

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq<AccountIdRef> for AccountId

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq<AccountIdRef> for str

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialEq<String> for &'a AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq<String> for AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialEq<str> for &'a AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq<str> for AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl PartialEq for AccountIdRef

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.
§

impl<'a> PartialOrd<&'a AccountIdRef> for AccountId

§

fn partial_cmp(&self, other: &&'a AccountIdRef) -> Option<Ordering>

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

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

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

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

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

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

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

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

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

impl<'a> PartialOrd<&'a AccountIdRef> for str

§

fn partial_cmp(&self, other: &&'a AccountIdRef) -> Option<Ordering>

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

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

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

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

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

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

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

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

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

impl<'a> PartialOrd<&'a str> for AccountIdRef

§

fn partial_cmp(&self, other: &&'a str) -> Option<Ordering>

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

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

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

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

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

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

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

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

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

impl<'a> PartialOrd<AccountId> for &'a AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl PartialOrd<AccountId> for AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl<'a> PartialOrd<AccountIdRef> for &'a str

§

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

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

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

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

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

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

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

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

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

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

impl PartialOrd<AccountIdRef> for AccountId

§

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

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

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

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

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

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

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

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

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

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

impl PartialOrd<AccountIdRef> for str

§

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

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

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

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

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

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

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

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

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

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

impl<'a> PartialOrd<String> for &'a AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl PartialOrd<String> for AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl<'a> PartialOrd<str> for &'a AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl PartialOrd<str> for AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl PartialOrd for AccountIdRef

§

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

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

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

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

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

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

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

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

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

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

impl Serialize for AccountIdRef

§

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

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

impl ToOwned for AccountIdRef

§

type Owned = AccountId

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> <AccountIdRef as ToOwned>::Owned

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

fn clone_into(&self, target: &mut Self::Owned)

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

impl<'s> TryFrom<&'s str> for &'s AccountIdRef

§

type Error = ParseAccountError

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

fn try_from( value: &'s str, ) -> Result<&'s AccountIdRef, <&'s AccountIdRef as TryFrom<&'s str>>::Error>

Performs the conversion.
§

impl TryIntoAccountId for &AccountIdRef

§

fn try_into_account_id(self) -> Result<AccountId, ParseAccountError>

Converts this type into an owned AccountId. Read more
§

fn as_str(&self) -> &str

§

impl Eq for AccountIdRef

§

impl StructuralPartialEq for AccountIdRef

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

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

§

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

Compare self to key and return their ordering.
§

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

§

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

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

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

§

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

Compare self to key and return true if they are equal.
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows 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) -> R
where R: 'a,

Mutably borrows 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
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,