pub struct RegistryCache { /* private fields */ }Expand description
Used to cache IBC path data from the chain registry for easy filtering.
Implementations§
Source§impl RegistryCache
impl RegistryCache
Sourcepub async fn get_path(
&self,
chain_a: &str,
chain_b: &str,
) -> Result<Option<IBCPath>, Report>
pub async fn get_path( &self, chain_a: &str, chain_b: &str, ) -> Result<Option<IBCPath>, Report>
Returns a cached IBCPath representing a channel between chain_a and chain_b if it exists.
Passing in the same value for chain_a and chain_b will always return Ok(None).
§Arguments
chain_a- A chain name. Must match a directory name in the root of the chain registry repository<https://github.com/cosmos/chain-registry>chain_b- A chain name. Must match a directory name in the root of the chain registry repository<https://github.com/cosmos/chain-registry>
Sourcepub async fn get_paths_filtered(&self, tag: Tag) -> Result<Vec<IBCPath>, Report>
pub async fn get_paths_filtered(&self, tag: Tag) -> Result<Vec<IBCPath>, Report>
Returns cached IBCPath that match a provided Tag
§Arguments
tag- ATagrepresenting the the desired key/value pair to filter by.
§Examples
ⓘ
use chain_registry::cache::{RegistryCache, Tag};
// store paths from the registry repository in a cache
let cache = RegistryCache::try_new().await?;
let dex = "osmosis".to_string();
// paths will contain a vec of all IBC paths containing the tag dex:osmosis
let paths = cache.get_paths_filtered(Tag::Dex(dex))?;Trait Implementations§
Source§impl Default for RegistryCache
impl Default for RegistryCache
Source§fn default() -> RegistryCache
fn default() -> RegistryCache
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RegistryCache
impl<'de> Deserialize<'de> for RegistryCache
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RegistryCache
impl RefUnwindSafe for RegistryCache
impl Send for RegistryCache
impl Sync for RegistryCache
impl Unpin for RegistryCache
impl UnsafeUnpin for RegistryCache
impl UnwindSafe for RegistryCache
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
Mutably borrows from an owned value. Read more