identity_iota::did

Trait DID

Source
pub trait DID:
    Clone
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Hash
    + FromStr
    + TryFrom<CoreDID>
    + Into<String>
    + Into<CoreDID>
    + AsRef<CoreDID> {
    const SCHEME: &'static str = BaseDIDUrl::SCHEME;

    // Provided methods
    fn scheme(&self) -> &'static str { ... }
    fn authority(&self) -> &str { ... }
    fn method(&self) -> &str { ... }
    fn method_id(&self) -> &str { ... }
    fn as_str(&self) -> &str { ... }
    fn into_string(self) -> String { ... }
    fn join(self, value: impl AsRef<str>) -> Result<DIDUrl, Error> { ... }
    fn to_url(&self) -> DIDUrl { ... }
    fn into_url(self) -> DIDUrl { ... }
}

Provided Associated Constants§

Source

const SCHEME: &'static str = BaseDIDUrl::SCHEME

Provided Methods§

Source

fn scheme(&self) -> &'static str

Returns the DID scheme. See DID::SCHEME.

E.g.

  • "did:example:12345678" -> "did"
  • "did:iota:main:12345678" -> "did"
Source

fn authority(&self) -> &str

Returns the DID authority: the method name and method-id.

E.g.

  • "did:example:12345678" -> "example:12345678"
  • "did:iota:main:12345678" -> "iota:main:12345678"
Source

fn method(&self) -> &str

Returns the DID method name.

E.g.

  • "did:example:12345678" -> "example"
  • "did:iota:main:12345678" -> "iota"
Source

fn method_id(&self) -> &str

Returns the DID method-specific ID.

E.g.

  • "did:example:12345678" -> "12345678"
  • "did:iota:main:12345678" -> "main:12345678"
Source

fn as_str(&self) -> &str

Returns the serialized DID.

This is fast since the serialized value is stored in the DID.

Source

fn into_string(self) -> String

Consumes the DID and returns its serialization.

Source

fn join(self, value: impl AsRef<str>) -> Result<DIDUrl, Error>

Constructs a DIDUrl by attempting to append a string representing a path, query, and/or fragment to this DID.

See DIDUrl::join.

Source

fn to_url(&self) -> DIDUrl

Clones the DID into a DIDUrl of the same method.

Source

fn into_url(self) -> DIDUrl

Converts the DID into a DIDUrl of the same method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§