Struct identity_iota::iota_core::IotaDID
source · [−]#[repr(transparent)]pub struct IotaDID(_);
Expand description
A DID conforming to the IOTA DID method specification.
This is a thin wrapper around the DID
type from the
identity_did
crate.
Implementations
sourceimpl IotaDID
impl IotaDID
sourcepub const DEFAULT_NETWORK: &'static str = "main"
pub const DEFAULT_NETWORK: &'static str = "main"
The default Tangle network ("main"
).
sourcepub fn new_with_network(
public: &[u8],
network: impl TryInto<NetworkName>
) -> Result<IotaDID, Error>
pub fn new_with_network(
public: &[u8],
network: impl TryInto<NetworkName>
) -> Result<IotaDID, Error>
Creates a new IotaDID
from the given public
key and network
.
Errors
Returns Err
if the input does not form a valid IotaDID
or the network
is invalid.
See NetworkName
for validation requirements.
sourcepub fn check_network<D>(did: &D) -> Result<(), Error> where
D: DID,
pub fn check_network<D>(did: &D) -> Result<(), Error> where
D: DID,
Checks if the given DID
has a valid IotaDID
network name, e.g. “main”, “dev”.
Errors
Returns Err
if the input is not a valid IotaDID
.
See NetworkName
for validation requirements.
sourcepub fn is_valid(did: &CoreDID) -> bool
pub fn is_valid(did: &CoreDID) -> bool
Returns a bool
indicating if the given DID
is valid according to the
IotaDID
method specification.
sourcepub fn network(&self) -> Result<Network, Error>
pub fn network(&self) -> Result<Network, Error>
Returns the Tangle network
of the DID
, if it is valid.
sourcepub fn network_str(&self) -> &str
pub fn network_str(&self) -> &str
Returns the Tangle network
name of the DID
.
Trait Implementations
sourceimpl DID for IotaDID
impl DID for IotaDID
sourcefn scheme(&self) -> &'static str
fn scheme(&self) -> &'static str
Returns the IotaDID
scheme. See DID::SCHEME
.
Returns the IotaDID
authority.
sourcefn into_string(self) -> String
fn into_string(self) -> String
Consumes the IotaDID
and returns the serialization.
sourcefn join(self, segment: impl AsRef<str>) -> Result<DIDUrl<IotaDID>, DIDError>
fn join(self, segment: impl AsRef<str>) -> Result<DIDUrl<IotaDID>, DIDError>
Creates a new IotaDIDUrl
by joining with a relative DID Url string.
Errors
Returns Err
if any base or relative DID segments are invalid.
const SCHEME: &'static str =
sourceimpl<'de> Deserialize<'de> for IotaDID
impl<'de> Deserialize<'de> for IotaDID
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<IotaDID, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<IotaDID, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Diff for IotaDID
impl Diff for IotaDID
type Type = DiffString
type Type = DiffString
diff chain features are slated for removal
The Corresponding Diff Type for the implemented Type.
sourcefn diff(&self, other: &IotaDID) -> Result<<IotaDID as Diff>::Type, Error>
fn diff(&self, other: &IotaDID) -> Result<<IotaDID as Diff>::Type, Error>
diff chain features are slated for removal
Finds the difference between two types; self
and other
and returns Self::Type
sourcefn merge(&self, diff: <IotaDID as Diff>::Type) -> Result<IotaDID, Error>
fn merge(&self, diff: <IotaDID as Diff>::Type) -> Result<IotaDID, Error>
diff chain features are slated for removal
Merges a Self::Type
with Self
sourceimpl KeyComparable for IotaDID
impl KeyComparable for IotaDID
sourceimpl Ord for IotaDID
impl Ord for IotaDID
sourceimpl PartialOrd<IotaDID> for IotaDID
impl PartialOrd<IotaDID> for IotaDID
sourcefn partial_cmp(&self, other: &IotaDID) -> Option<Ordering>
fn partial_cmp(&self, other: &IotaDID) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for IotaDID
impl Serialize for IotaDID
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 IotaDID
impl StructuralEq for IotaDID
impl StructuralPartialEq for IotaDID
Auto Trait Implementations
impl RefUnwindSafe for IotaDID
impl Send for IotaDID
impl Sync for IotaDID
impl Unpin for IotaDID
impl UnwindSafe for IotaDID
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