#[non_exhaustive]pub struct MethodCapabilities {
pub updatable: bool,
pub hosting: Hosting,
pub single_key: bool,
pub fixed_fragment: Option<&'static str>,
}Expand description
What a DID method can do, declared by its DidProducer so an application can pick a
method without knowing it.
§Examples
use identity_kit::resolver::{Hosting, MethodCapabilities};
// did:jwk: one key, no updates, the method is always `#0`.
let jwk = MethodCapabilities::new(Hosting::Embedded)
.with_single_key(true)
.with_fixed_fragment("0");
assert!(!jwk.updatable);
assert_eq!(jwk.fixed_fragment, Some("0"));
// did:web: any number of keys, updated by republishing the document.
let web = MethodCapabilities::new(Hosting::Web).with_updatable(true);
assert!(web.updatable && !web.single_key && web.fixed_fragment.is_none());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.updatable: boolWhether a document can change after creation. An embedded method never can.
hosting: HostingWhere the documents live.
single_key: boolWhether a document holds exactly one verification method.
fixed_fragment: Option<&'static str>The fragment every verification method of the method is named with (0 for did:jwk),
or None when the fragment depends on the key or on the caller.
Implementations§
Source§impl MethodCapabilities
impl MethodCapabilities
Sourcepub const fn new(hosting: Hosting) -> Self
pub const fn new(hosting: Hosting) -> Self
Capabilities of a method hosted as hosting: not updatable, any number of keys, no fixed
fragment.
Sourcepub const fn with_updatable(self, updatable: bool) -> Self
pub const fn with_updatable(self, updatable: bool) -> Self
These capabilities with updatable set.
Sourcepub const fn with_single_key(self, single_key: bool) -> Self
pub const fn with_single_key(self, single_key: bool) -> Self
These capabilities with single_key set.
Sourcepub const fn with_fixed_fragment(self, fragment: &'static str) -> Self
pub const fn with_fixed_fragment(self, fragment: &'static str) -> Self
These capabilities with fixed_fragment set.
Trait Implementations§
Source§impl Clone for MethodCapabilities
impl Clone for MethodCapabilities
Source§impl Debug for MethodCapabilities
impl Debug for MethodCapabilities
impl Eq for MethodCapabilities
Source§impl Hash for MethodCapabilities
impl Hash for MethodCapabilities
Source§impl PartialEq for MethodCapabilities
impl PartialEq for MethodCapabilities
impl StructuralPartialEq for MethodCapabilities
Auto Trait Implementations§
impl Freeze for MethodCapabilities
impl RefUnwindSafe for MethodCapabilities
impl Send for MethodCapabilities
impl Sync for MethodCapabilities
impl Unpin for MethodCapabilities
impl UnsafeUnpin for MethodCapabilities
impl UnwindSafe for MethodCapabilities
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.