#[non_exhaustive]pub struct ResolutionResult {
pub document: Option<DidDocument>,
pub resolution_metadata: ResolutionMetadata,
pub document_metadata: DocumentMetadata,
}Expand description
What a resolver returns: the document when resolution succeeded, and the two metadata structures (DID Core §7.1.1).
§Examples
use identity_kit::did::{ResolutionErrorKind, ResolutionResult};
let failed = ResolutionResult::error(ResolutionErrorKind::NotFound);
assert_eq!(
serde_json::to_string(&failed)?,
r#"{"didResolutionMetadata":{"error":"notFound"},"didDocumentMetadata":{}}"#
);
assert_eq!(failed.into_document().unwrap_err(), ResolutionErrorKind::NotFound);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.document: Option<DidDocument>The DID document, absent when resolution failed.
resolution_metadata: ResolutionMetadataMetadata about the resolution process.
document_metadata: DocumentMetadataMetadata about the document.
Implementations§
Source§impl ResolutionResult
impl ResolutionResult
Sourcepub fn new(document: DidDocument) -> Self
pub fn new(document: DidDocument) -> Self
A successful result holding document.
Sourcepub fn error(error: impl Into<ResolutionError>) -> Self
pub fn error(error: impl Into<ResolutionError>) -> Self
A failed result reporting error, a ResolutionError or a bare
ResolutionErrorKind.
Sourcepub fn with_document_metadata(self, metadata: DocumentMetadata) -> Self
pub fn with_document_metadata(self, metadata: DocumentMetadata) -> Self
This result with document_metadata.
Sourcepub fn with_resolution_metadata(self, metadata: ResolutionMetadata) -> Self
pub fn with_resolution_metadata(self, metadata: ResolutionMetadata) -> Self
This result with resolution_metadata.
Sourcepub fn error_kind(&self) -> Option<&ResolutionErrorKind>
pub fn error_kind(&self) -> Option<&ResolutionErrorKind>
The keyword of the reported error, if any; the error itself, with its detail and source,
is in resolution_metadata.
Sourcepub fn into_document(self) -> Result<DidDocument, ResolutionError>
pub fn into_document(self) -> Result<DidDocument, ResolutionError>
The document, or the reported error; a result with neither counts as
ResolutionErrorKind::NotFound.
§Errors
The ResolutionError of the resolution metadata.
Trait Implementations§
Source§impl Clone for ResolutionResult
impl Clone for ResolutionResult
Source§impl Debug for ResolutionResult
impl Debug for ResolutionResult
Source§impl Default for ResolutionResult
impl Default for ResolutionResult
Source§impl<'de> Deserialize<'de> for ResolutionResult
impl<'de> Deserialize<'de> for ResolutionResult
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
Source§impl Display for ResolutionResult
impl Display for ResolutionResult
impl Eq for ResolutionResult
Source§impl PartialEq for ResolutionResult
impl PartialEq for ResolutionResult
Source§impl Serialize for ResolutionResult
impl Serialize for ResolutionResult
impl StructuralPartialEq for ResolutionResult
Auto Trait Implementations§
impl !RefUnwindSafe for ResolutionResult
impl !UnwindSafe for ResolutionResult
impl Freeze for ResolutionResult
impl Send for ResolutionResult
impl Sync for ResolutionResult
impl Unpin for ResolutionResult
impl UnsafeUnpin for ResolutionResult
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.