Struct identity_iota_client::tangle::ExplorerUrl
source · #[repr(transparent)]pub struct ExplorerUrl(_);
Expand description
A Tangle explorer URL with convenience functions for constructing URLs for viewing published messages or IOTA DIDs.
Example
let explorer = ExplorerUrl::mainnet();
let did = IotaDID::parse("did:iota:H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV")?;
assert_eq!(
explorer.resolver_url(&did)?,
"https://explorer.iota.org/mainnet/identity-resolver/did:iota:H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
);
Implementations§
source§impl ExplorerUrl
impl ExplorerUrl
sourcepub fn new(url: Url) -> Result<Self>
pub fn new(url: Url) -> Result<Self>
Constructs a new Tangle explorer URL.
Use ExplorerUrl::mainnet
or ExplorerUrl::devnet
unless using a private Tangle
or local explorer.
NOTE: does not validate whether this corresponds to an actual Tangle explorer.
sourcepub fn parse(url: &str) -> Result<Self>
pub fn parse(url: &str) -> Result<Self>
Constructs a new Tangle explorer URL from a string.
See ExplorerUrl::new
.
Example
Point to a Tangle explorer deployed locally.
let explorer = ExplorerUrl::parse("http://127.0.0.1:8082/")?;
sourcepub fn mainnet() -> &'static ExplorerUrl
pub fn mainnet() -> &'static ExplorerUrl
Returns the Tangle explorer URL for the mainnet.
sourcepub fn devnet() -> &'static ExplorerUrl
pub fn devnet() -> &'static ExplorerUrl
Returns the Tangle explorer URL for the devnet.
sourcepub fn message_url(&self, message_id: &MessageId) -> Result<Url>
pub fn message_url(&self, message_id: &MessageId) -> Result<Url>
Returns the web explorer URL of the given message_id
.
E.g. https://explorer.iota.org/mainnet/message/<message_id>
sourcepub fn resolver_url(&self, did: &impl DID) -> Result<Url>
pub fn resolver_url(&self, did: &impl DID) -> Result<Url>
Returns the web identity resolver URL for the given DID.
E.g. https://explorer.iota.org/mainnet/identity-resolver/<did>
Trait Implementations§
source§impl AsRef<str> for ExplorerUrl
impl AsRef<str> for ExplorerUrl
source§impl Clone for ExplorerUrl
impl Clone for ExplorerUrl
source§fn clone(&self) -> ExplorerUrl
fn clone(&self) -> ExplorerUrl
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExplorerUrl
impl Debug for ExplorerUrl
source§impl<'de> Deserialize<'de> for ExplorerUrl
impl<'de> Deserialize<'de> for ExplorerUrl
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>,
source§impl Display for ExplorerUrl
impl Display for ExplorerUrl
source§impl FromStr for ExplorerUrl
impl FromStr for ExplorerUrl
source§impl PartialEq<ExplorerUrl> for ExplorerUrl
impl PartialEq<ExplorerUrl> for ExplorerUrl
source§fn eq(&self, other: &ExplorerUrl) -> bool
fn eq(&self, other: &ExplorerUrl) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ExplorerUrl
impl Serialize for ExplorerUrl
source§impl TryFrom<&str> for ExplorerUrl
impl TryFrom<&str> for ExplorerUrl
source§impl TryFrom<Url> for ExplorerUrl
impl TryFrom<Url> for ExplorerUrl
impl Eq for ExplorerUrl
impl StructuralEq for ExplorerUrl
impl StructuralPartialEq for ExplorerUrl
Auto Trait Implementations§
impl RefUnwindSafe for ExplorerUrl
impl Send for ExplorerUrl
impl Sync for ExplorerUrl
impl Unpin for ExplorerUrl
impl UnwindSafe for ExplorerUrl
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromJson for Twhere T: for<'de> Deserialize<'de>,
source§fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>
fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>
Self
from a string of JSON text.source§fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>
fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>
Self
from bytes of JSON text.source§fn from_json_value(json: Value) -> Result<Self, Error>
fn from_json_value(json: Value) -> Result<Self, Error>
Self
from a serde_json::Value
.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> ToJson for Twhere
T: Serialize,
impl<T> ToJson for Twhere T: Serialize,
source§fn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
self
as a serde_json::Value
.