pub struct Did(pub String);Expand description
A Decentralized Identifier (DID) for an agent.
DIDs follow the W3C DID Core specification. For CELLSTATE agents,
we use the did:web method which resolves via HTTPS.
Format: did:web:{domain}:agents:{agent-uuid}
Tuple Fields§
§0: StringImplementations§
Source§impl Did
impl Did
Sourcepub fn web(domain: &str, agent_id: Uuid) -> Self
pub fn web(domain: &str, agent_id: Uuid) -> Self
Create a did:web identifier for an agent.
§Arguments
domain- The domain hosting the DID document (e.g., “cellstate.batterypack.dev”)agent_id- The agent’s UUID
§Examples
let id = Uuid::nil();
let did = Did::web("cellstate.batterypack.dev", id);
assert_eq!(did.0, "did:web:cellstate.batterypack.dev:agents:00000000-0000-0000-0000-000000000000");Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a DID string, returning Some(Did) if it begins with did:.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Did
impl<'de> Deserialize<'de> for Did
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Did
impl StructuralPartialEq for Did
Auto Trait Implementations§
impl Freeze for Did
impl RefUnwindSafe for Did
impl Send for Did
impl Sync for Did
impl Unpin for Did
impl UnwindSafe for Did
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.