pub trait TokenStore<'a>: Sized {
type Item: Deref<Target = Token>;
// Required methods
fn get(&'a self, chain_id: u64, id: TokenId) -> Option<Self::Item>;
fn get_mut(&mut self, chain_id: u64, id: TokenId) -> Option<&mut Token>;
fn insert(&mut self, chain_id: u64, token: Token);
fn contains(&self, chain_id: u64, id: TokenId) -> bool;
fn symbols(&'a self, chain_id: Option<u64>) -> Vec<String>;
fn addresses(&'a self, chain_id: Option<u64>) -> Vec<Address>;
// Provided methods
fn entry(&'a mut self, chain_id: u64, id: TokenId) -> Entry<'a, Self> { ... }
fn iter(&'a self, chain_id: u64) -> StoreIter<'a, Self> ⓘ { ... }
}Expand description
A Token store
Required Associated Types§
Required Methods§
Sourcefn get(&'a self, chain_id: u64, id: TokenId) -> Option<Self::Item>
fn get(&'a self, chain_id: u64, id: TokenId) -> Option<Self::Item>
Returns the value corresponding to the given id.
Sourcefn get_mut(&mut self, chain_id: u64, id: TokenId) -> Option<&mut Token>
fn get_mut(&mut self, chain_id: u64, id: TokenId) -> Option<&mut Token>
Returns the mutable value corresponding to the given id.
Sourcefn contains(&self, chain_id: u64, id: TokenId) -> bool
fn contains(&self, chain_id: u64, id: TokenId) -> bool
Returns true if the store contains a value for the specified id.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.