Enum identity_iota::iota_core::Network
source · [−]pub enum Network {
Mainnet,
Devnet,
Other(NetworkName),
}
Variants
Mainnet
Devnet
Other(NetworkName)
Implementations
sourceimpl Network
impl Network
sourcepub fn try_from_name<S>(name: S) -> Result<Network, Error> where
S: AsRef<str> + Into<Cow<'static, str>>,
pub fn try_from_name<S>(name: S) -> Result<Network, Error> where
S: AsRef<str> + Into<Cow<'static, str>>,
Parses the provided string to a Network
.
The names "main"
and "dev"
are mapped to the well-known Mainnet
and Devnet
networks respectively.
Other inputs will return an instance of Other
if the name is valid.
It must match a part or all of the networkId
returned in the nodeinfo from a node.
For example, if the networkId is "private-tangle"
, "tangle"
can be used.
Network names must comply with the IOTA DID Method spec, that is: be non-empty, at most
6 characters long, and only include alphanumeric characters 0-9
and a-z
.
See NetworkName
.
sourcepub fn matches_did(self, did: &IotaDID) -> bool
pub fn matches_did(self, did: &IotaDID) -> bool
Returns true if this network is the same network as specified in the DID.
sourcepub fn default_node_url(&self) -> Option<&'static Url>
pub fn default_node_url(&self) -> Option<&'static Url>
Returns the default node Url
of the Tangle network.
sourcepub fn name(&self) -> NetworkName
pub fn name(&self) -> NetworkName
Returns the NetworkName
of the network.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Network
impl<'de> Deserialize<'de> for Network
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Network, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Network, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for Network
impl Serialize for Network
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
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 Eq for Network
impl StructuralEq for Network
impl StructuralPartialEq for Network
Auto Trait Implementations
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnwindSafe for Network
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> FromJson for T where
T: for<'de> Deserialize<'de>,
impl<T> FromJson for T where
T: for<'de> Deserialize<'de>,
sourcefn from_json(json: &impl AsRef<str>) -> Result<Self, Error>
fn from_json(json: &impl AsRef<str>) -> Result<Self, Error>
Deserialize Self
from a string of JSON text.
sourcefn from_json_slice(json: &impl AsRef<[u8]>) -> Result<Self, Error>
fn from_json_slice(json: &impl AsRef<[u8]>) -> Result<Self, Error>
Deserialize Self
from bytes of JSON text.
sourcefn from_json_value(json: Value) -> Result<Self, Error>
fn from_json_value(json: Value) -> Result<Self, Error>
Deserialize Self
from a [serde_json::Value
].
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToJson for T where
T: Serialize,
impl<T> ToJson for T where
T: Serialize,
sourcefn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
Serialize self
as a [serde_json::Value
].
sourcefn to_json_pretty(&self) -> Result<String, Error>
fn to_json_pretty(&self) -> Result<String, Error>
Serialize self
as a pretty-printed string of JSON.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more