#[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

source

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.

source

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/")?;
source

pub fn mainnet() -> &'static ExplorerUrl

Returns the Tangle explorer URL for the mainnet.

source

pub fn devnet() -> &'static ExplorerUrl

Returns the Tangle explorer URL for the devnet.

source

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>

source

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

source§

fn as_ref(&self) -> &str

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

impl Clone for ExplorerUrl

source§

fn clone(&self) -> ExplorerUrl

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 ExplorerUrl

source§

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

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

impl<'de> Deserialize<'de> for ExplorerUrl

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

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

impl Display for ExplorerUrl

source§

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

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

impl FromStr for ExplorerUrl

§

type Err = Error

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

fn from_str(url: &str) -> Result<Self, Self::Err>

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

impl PartialEq<ExplorerUrl> for ExplorerUrl

source§

fn eq(&self, other: &ExplorerUrl) -> 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 Serialize for ExplorerUrl

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

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

impl TryFrom<&str> for ExplorerUrl

§

type Error = Error

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

fn try_from(url: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Url> for ExplorerUrl

§

type Error = Error

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

fn try_from(url: Url) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for ExplorerUrl

source§

impl StructuralEq for ExplorerUrl

source§

impl StructuralPartialEq for ExplorerUrl

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere 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 Twhere 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 Twhere 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 Twhere 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<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToJson for Twhere 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, Global>, 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§

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

Serialize self as a JSON byte vector, normalized using JSON Canonicalization Scheme (JCS).
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere 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<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 Twhere T: for<'de> Deserialize<'de>,