Struct identity_iota::prelude::IotaDocument
source · [−]pub struct IotaDocument {
pub metadata: IotaDocumentMetadata,
pub proof: Option<Proof>,
/* private fields */
}
Expand description
A DID Document adhering to the IOTA DID method specification.
This extends CoreDocument
.
Fields
metadata: IotaDocumentMetadata
proof: Option<Proof>
Implementations
sourceimpl IotaDocument
impl IotaDocument
pub const UPDATE_METHOD_TYPES: &'static [MethodType] = &[MethodType::Ed25519VerificationKey2018]
pub const DEFAULT_METHOD_FRAGMENT: &'static str = "sign-0"
sourcepub fn new(keypair: &KeyPair) -> Result<IotaDocument, Error>
pub fn new(keypair: &KeyPair) -> Result<IotaDocument, Error>
Creates a new DID Document from the given KeyPair
.
The DID Document will be pre-populated with a single verification method
derived from the provided KeyPair
embedded as a capability invocation
verification relationship. This method will have the DID URL fragment
#sign-0
and can be easily retrieved with IotaDocument::default_signing_method
.
NOTE: the generated document is unsigned, see IotaDocument::sign_self
.
Example:
// Create a DID Document from a new Ed25519 keypair.
let keypair = KeyPair::new(KeyType::Ed25519).unwrap();
let document = IotaDocument::new(&keypair).unwrap();
sourcepub fn new_with_options(
keypair: &KeyPair,
network: Option<NetworkName>,
fragment: Option<&str>
) -> Result<IotaDocument, Error>
pub fn new_with_options(
keypair: &KeyPair,
network: Option<NetworkName>,
fragment: Option<&str>
) -> Result<IotaDocument, Error>
Creates a new DID Document from the given KeyPair
, network, and verification method
fragment name.
See IotaDocument::new
.
Arguments:
- keypair: the initial verification method is derived from the public key of this
KeyPair
. - network: Tangle network to use for the DID; default
Network::Mainnet
. - fragment: name of the initial verification method; default
DEFAULT_METHOD_FRAGMENT
.
Example:
// Create a new DID Document for the devnet from a new Ed25519 keypair.
let keypair = KeyPair::new(KeyType::Ed25519).unwrap();
let document = IotaDocument::new_with_options(&keypair, Some(Network::Devnet.name()), Some("auth-key")).unwrap();
assert_eq!(document.id().network_str(), "dev");
assert_eq!(
document.default_signing_method().unwrap().id().fragment().unwrap(),
"auth-key"
);
sourcepub fn from_verification_method(
method: VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>
) -> Result<IotaDocument, Error>
pub fn from_verification_method(
method: VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>
) -> Result<IotaDocument, Error>
Creates a new DID Document from the given IotaVerificationMethod
, inserting it as the
default capability invocation method.
NOTE: the generated document is unsigned, see IotaDocument::sign_self
.
sourcepub fn is_signing_method_type(method_type: MethodType) -> bool
pub fn is_signing_method_type(method_type: MethodType) -> bool
Returns whether the given MethodType
can be used to sign document updates.
sourcepub fn core_document(
&self
) -> &CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
pub fn core_document(
&self
) -> &CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
Returns a reference to the underlying IotaCoreDocument
.
sourcepub fn core_document_mut(
&mut self
) -> &mut CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
pub fn core_document_mut(
&mut self
) -> &mut CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
Returns a mutable reference to the underlying IotaCoreDocument
.
sourcepub fn controller(&self) -> Option<&OneOrSet<IotaDID>>
pub fn controller(&self) -> Option<&OneOrSet<IotaDID>>
Returns a reference to the IotaDocument
controllers.
sourcepub fn controller_mut(&mut self) -> &mut Option<OneOrSet<IotaDID>>
pub fn controller_mut(&mut self) -> &mut Option<OneOrSet<IotaDID>>
Returns a mutable reference to the IotaDocument
controllers.
sourcepub fn also_known_as(&self) -> &OrderedSet<Url>
pub fn also_known_as(&self) -> &OrderedSet<Url>
Returns a reference to the IotaDocument
alsoKnownAs set.
sourcepub fn also_known_as_mut(&mut self) -> &mut OrderedSet<Url>
pub fn also_known_as_mut(&mut self) -> &mut OrderedSet<Url>
Returns a mutable reference to the IotaDocument
alsoKnownAs set.
sourcepub fn default_signing_method(
&self
) -> Result<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>, Error>
pub fn default_signing_method(
&self
) -> Result<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>, Error>
Returns the first IotaVerificationMethod
with a capability invocation relationship
capable of signing this DID document.
sourcepub fn properties(&self) -> &BTreeMap<String, Value, Global>
pub fn properties(&self) -> &BTreeMap<String, Value, Global>
Returns a reference to the custom DID Document properties.
sourcepub fn properties_mut(&mut self) -> &mut BTreeMap<String, Value, Global>
pub fn properties_mut(&mut self) -> &mut BTreeMap<String, Value, Global>
Returns a mutable reference to the custom DID Document properties.
sourcepub fn service(
&self
) -> &OrderedSet<Service<IotaDID, BTreeMap<String, Value, Global>>>
pub fn service(
&self
) -> &OrderedSet<Service<IotaDID, BTreeMap<String, Value, Global>>>
Return a set of all Service
s in the document.
sourcepub fn insert_service(
&mut self,
service: Service<IotaDID, BTreeMap<String, Value, Global>>
) -> bool
pub fn insert_service(
&mut self,
service: Service<IotaDID, BTreeMap<String, Value, Global>>
) -> bool
Add a new IotaService
to the document.
Returns true
if the service was added.
sourcepub fn remove_service(&mut self, did_url: &DIDUrl<IotaDID>) -> bool
pub fn remove_service(&mut self, did_url: &DIDUrl<IotaDID>) -> bool
Remove a IotaService
identified by the given IotaDIDUrl
from the document.
Returns true
if a service was removed.
sourcepub fn methods(
&self
) -> impl Iterator<Item = &VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>>
pub fn methods(
&self
) -> impl Iterator<Item = &VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>>
Returns an iterator over all IotaVerificationMethods
in the DID Document.
sourcepub fn insert_method(
&mut self,
method: VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>,
scope: MethodScope
) -> Result<(), Error>
pub fn insert_method(
&mut self,
method: VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>,
scope: MethodScope
) -> Result<(), Error>
Adds a new IotaVerificationMethod
to the document in the given MethodScope
.
Errors
Returns an error if a method with the same fragment already exists.
sourcepub fn remove_method(&mut self, did_url: &DIDUrl<IotaDID>) -> Result<(), Error>
pub fn remove_method(&mut self, did_url: &DIDUrl<IotaDID>) -> Result<(), Error>
Removes all references to the specified VerificationMethod
.
Errors
Returns an error if the method does not exist.
sourcepub fn attach_method_relationship(
&mut self,
did_url: &DIDUrl<IotaDID>,
relationship: MethodRelationship
) -> Result<bool, Error>
pub fn attach_method_relationship(
&mut self,
did_url: &DIDUrl<IotaDID>,
relationship: MethodRelationship
) -> Result<bool, Error>
Attaches the relationship to the given method, if the method exists.
Note: The method needs to be in the set of verification methods, so it cannot be an embedded one.
sourcepub fn detach_method_relationship(
&mut self,
did_url: &DIDUrl<IotaDID>,
relationship: MethodRelationship
) -> Result<bool, Error>
pub fn detach_method_relationship(
&mut self,
did_url: &DIDUrl<IotaDID>,
relationship: MethodRelationship
) -> Result<bool, Error>
Detaches the given relationship from the given method, if the method exists.
sourcepub fn resolve_method<'query, Q>(
&self,
query: Q,
scope: Option<MethodScope>
) -> Option<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>> where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_method<'query, Q>(
&self,
query: Q,
scope: Option<MethodScope>
) -> Option<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>> where
Q: Into<DIDUrlQuery<'query>>,
Returns the first IotaVerificationMethod
with an id
property matching the
provided query
and the verification relationship specified by scope
if present.
sourcepub fn resolve_method_mut<'query, Q>(
&mut self,
query: Q,
scope: Option<MethodScope>
) -> Option<&mut VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>> where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_method_mut<'query, Q>(
&mut self,
query: Q,
scope: Option<MethodScope>
) -> Option<&mut VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>> where
Q: Into<DIDUrlQuery<'query>>,
Returns the first IotaVerificationMethod
with an id
property matching the
provided query
and the verification relationship specified by scope
if present.
WARNING: improper usage of this allows violating the uniqueness of the verification method sets.
sourcepub fn resolve_signing_method<'query, Q>(
&self,
query: Q
) -> Result<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>, Error> where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_signing_method<'query, Q>(
&self,
query: Q
) -> Result<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>, Error> where
Q: Into<DIDUrlQuery<'query>>,
Attempts to resolve the given method query into a method capable of signing a document update.
sourcepub fn signer(
&'base self,
private_key: &'base Key<Private>
) -> DocumentSigner<'base, 'base, IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
pub fn signer(
&'base self,
private_key: &'base Key<Private>
) -> DocumentSigner<'base, 'base, IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
Creates a new DocumentSigner
that can be used to create digital signatures
from verification methods in this DID Document.
sourcepub fn sign_data<'query, 'this, X, Q>(
&'this self,
data: &mut X,
private_key: &'this Key<Private>,
method_query: Q,
options: ProofOptions
) -> Result<(), Error> where
'this: 'query,
X: Serialize + SetSignature + TryMethod,
Q: Into<DIDUrlQuery<'query>>,
pub fn sign_data<'query, 'this, X, Q>(
&'this self,
data: &mut X,
private_key: &'this Key<Private>,
method_query: Q,
options: ProofOptions
) -> Result<(), Error> where
'this: 'query,
X: Serialize + SetSignature + TryMethod,
Q: Into<DIDUrlQuery<'query>>,
Signs the provided data
with the verification method specified by method_query
.
See IotaDocument::signer
for creating signatures with a builder pattern.
NOTE: does not validate whether private_key
corresponds to the verification method.
See IotaDocument::verify_data
.
Errors
Fails if an unsupported verification method is used, data serialization fails, or the signature operation fails.
sourcepub fn sign_self<'query, Q>(
&mut self,
private_key: &Key<Private>,
method_query: Q
) -> Result<(), Error> where
Q: Into<DIDUrlQuery<'query>>,
pub fn sign_self<'query, Q>(
&mut self,
private_key: &Key<Private>,
method_query: Q
) -> Result<(), Error> where
Q: Into<DIDUrlQuery<'query>>,
Signs this DID document with the verification method specified by method_query
.
The method_query
may be the full IotaDIDUrl
of the method or just its fragment,
e.g. “#sign-0”. The signing method must have a capability invocation verification
relationship.
NOTE: does not validate whether private_key
corresponds to the verification method.
See IotaDocument::verify_document
.
Errors
Fails if an unsupported verification method is used or the signature operation fails.
sourcepub fn verify_data<X>(
&self,
data: &X,
options: &VerifierOptions
) -> Result<(), Error> where
X: Serialize + GetSignature,
pub fn verify_data<X>(
&self,
data: &X,
options: &VerifierOptions
) -> Result<(), Error> where
X: Serialize + GetSignature,
Verifies the signature of the provided data
was created using a verification method
in this DID Document.
Errors
Fails if an unsupported verification method is used, document serialization fails, or the verification operation fails.
sourcepub fn verify_document(&self, signed: &IotaDocument) -> Result<(), Error>
pub fn verify_document(&self, signed: &IotaDocument) -> Result<(), Error>
Verifies that the signature on the DID document signed
was generated by a valid method from
this DID document.
Errors
Fails if:
- The signature proof section is missing in the
signed
document. - The method is not found in this document.
- An unsupported verification method is used.
- The signature verification operation fails.
sourcepub fn verify_root_document(document: &IotaDocument) -> Result<(), Error>
pub fn verify_root_document(document: &IotaDocument) -> Result<(), Error>
Verifies whether document
is a valid root DID document according to the IOTA DID method
specification.
It must be signed using a verification method with a public key whose BLAKE2b-256 hash matches the DID tag.
sourcepub fn diff<'query, 's, Q>(
&'query self,
other: &IotaDocument,
message_id: MessageId,
private_key: &'query Key<Private>,
method_query: Q
) -> Result<DiffMessage, Error> where
's: 'query,
Q: Into<DIDUrlQuery<'query>>,
👎 Deprecated since 0.5.0: diff chain features are slated for removal
pub fn diff<'query, 's, Q>(
&'query self,
other: &IotaDocument,
message_id: MessageId,
private_key: &'query Key<Private>,
method_query: Q
) -> Result<DiffMessage, Error> where
's: 'query,
Q: Into<DIDUrlQuery<'query>>,
diff chain features are slated for removal
Creates a DiffMessage
representing the changes between self
and other
.
The returned DiffMessage
will have a digital signature created using the
specified private_key
and method_query
.
NOTE: the method must be a capability invocation method.
Errors
Fails if the diff operation or signature operation fails.
sourcepub fn verify_diff(&self, diff: &DiffMessage) -> Result<(), Error>
👎 Deprecated since 0.5.0: diff chain features are slated for removal
pub fn verify_diff(&self, diff: &DiffMessage) -> Result<(), Error>
diff chain features are slated for removal
Verifies the signature of the diff
was created using a capability invocation method
in this DID Document.
Errors
Fails if an unsupported verification method is used or the verification operation fails.
sourcepub fn merge_diff(&mut self, diff: &DiffMessage) -> Result<(), Error>
👎 Deprecated since 0.5.0: diff chain features are slated for removal
pub fn merge_diff(&mut self, diff: &DiffMessage) -> Result<(), Error>
diff chain features are slated for removal
Verifies a DiffMessage
signature and merges the changes into self
.
If merging fails self
remains unmodified, otherwise self
represents
the merged document state.
See IotaDocument::verify_diff
.
Errors
Fails if the merge operation or signature operation fails.
sourcepub fn integration_index(&self) -> &str
pub fn integration_index(&self) -> &str
Returns the Tangle index of the integration chain for this DID.
This is equivalent to the tag segment of the IotaDID
.
E.g.
For an IotaDocument
doc
with "did:iota:1234567890abcdefghijklmnopqrstuvxyzABCDEFGHI"
,
doc.integration_index() == "1234567890abcdefghijklmnopqrstuvxyzABCDEFGHI"
sourcepub fn diff_index(message_id: &MessageId) -> Result<String, Error>
👎 Deprecated since 0.5.0: diff chain features are slated for removal
pub fn diff_index(message_id: &MessageId) -> Result<String, Error>
diff chain features are slated for removal
Returns the Tangle index of the DID diff chain. This should only be called on messages from documents published on the integration chain.
This is the Base58-btc encoded SHA-256 digest of the hex-encoded message id.
sourcepub fn extract_signing_keys(
&self
) -> Vec<Option<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn extract_signing_keys(
&self
) -> Vec<Option<&VerificationMethod<IotaDID, BTreeMap<String, Value, Global>>>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns a vector of all verification methods capable of signing a document update.
sourcepub fn revoke_credentials(
&mut self,
service_id: &DIDUrl<IotaDID>,
credential_indices: &[u32]
) -> Result<(), Error>
pub fn revoke_credentials(
&mut self,
service_id: &DIDUrl<IotaDID>,
credential_indices: &[u32]
) -> Result<(), Error>
If the document has a RevocationBitmap
service identified by fragment
,
revoke all credentials with a revocationBitmapIndex
in credential_indices
.
sourcepub fn unrevoke_credentials(
&mut self,
service_id: &DIDUrl<IotaDID>,
credential_indices: &[u32]
) -> Result<(), Error>
pub fn unrevoke_credentials(
&mut self,
service_id: &DIDUrl<IotaDID>,
credential_indices: &[u32]
) -> Result<(), Error>
If the document has a RevocationBitmap
service identified by fragment
,
unrevoke all credentials with a revocationBitmapIndex
in credential_indices
.
Trait Implementations
sourceimpl AsRef<IotaDocument> for ResolvedIotaDocument
impl AsRef<IotaDocument> for ResolvedIotaDocument
sourcefn as_ref(&self) -> &IotaDocument
fn as_ref(&self) -> &IotaDocument
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl AsRef<IotaDocument> for IotaDocument
impl AsRef<IotaDocument> for IotaDocument
sourcefn as_ref(&self) -> &IotaDocument
fn as_ref(&self) -> &IotaDocument
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for IotaDocument
impl Clone for IotaDocument
sourcefn clone(&self) -> IotaDocument
fn clone(&self) -> IotaDocument
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for IotaDocument
impl Debug for IotaDocument
sourceimpl<'de> Deserialize<'de> for IotaDocument
impl<'de> Deserialize<'de> for IotaDocument
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<IotaDocument, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<IotaDocument, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Diff for IotaDocument
impl Diff for IotaDocument
type Type = DiffIotaDocument
type Type = DiffIotaDocument
diff chain features are slated for removal
The Corresponding Diff Type for the implemented Type.
sourcefn diff(
&self,
other: &IotaDocument
) -> Result<<IotaDocument as Diff>::Type, Error>
fn diff(
&self,
other: &IotaDocument
) -> Result<<IotaDocument 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: <IotaDocument as Diff>::Type
) -> Result<IotaDocument, Error>
fn merge(
&self,
diff: <IotaDocument as Diff>::Type
) -> Result<IotaDocument, Error>
diff chain features are slated for removal
Merges a Self::Type
with Self
sourcefn from_diff(diff: <IotaDocument as Diff>::Type) -> Result<IotaDocument, Error>
fn from_diff(diff: <IotaDocument as Diff>::Type) -> Result<IotaDocument, Error>
diff chain features are slated for removal
Converts a diff
of type Self::Type
to a Self
.
sourceimpl Display for IotaDocument
impl Display for IotaDocument
sourceimpl From<(CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>, IotaDocumentMetadata, Option<Proof>)> for IotaDocument
impl From<(CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>, IotaDocumentMetadata, Option<Proof>)> for IotaDocument
sourceimpl From<IotaDocument> for ResolvedIotaDocument
impl From<IotaDocument> for ResolvedIotaDocument
sourcefn from(document: IotaDocument) -> ResolvedIotaDocument
fn from(document: IotaDocument) -> ResolvedIotaDocument
Converts to this type from the input type.
sourceimpl From<IotaDocument> for CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
impl From<IotaDocument> for CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
sourceimpl GetSignature for IotaDocument
impl GetSignature for IotaDocument
sourceimpl GetSignatureMut for IotaDocument
impl GetSignatureMut for IotaDocument
sourcefn signature_mut(&mut self) -> Option<&mut Proof>
fn signature_mut(&mut self) -> Option<&mut Proof>
Returns a mutable reference to the Proof
object, if any.
sourceimpl PartialEq<IotaDocument> for IotaDocument
impl PartialEq<IotaDocument> for IotaDocument
sourcefn eq(&self, other: &IotaDocument) -> bool
fn eq(&self, other: &IotaDocument) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &IotaDocument) -> bool
fn ne(&self, other: &IotaDocument) -> bool
This method tests for !=
.
sourceimpl Serialize for IotaDocument
impl Serialize for IotaDocument
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
sourceimpl SetSignature for IotaDocument
impl SetSignature for IotaDocument
sourcefn set_signature(&mut self, signature: Proof)
fn set_signature(&mut self, signature: Proof)
Sets the Proof
object of self
.
sourceimpl TryMethod for IotaDocument
impl TryMethod for IotaDocument
sourceconst TYPE: MethodUriType = MethodUriType::Absolute
const TYPE: MethodUriType = MethodUriType::Absolute
Flag that determines whether absolute or rleative URI
sourcefn method<D, U>(method: &VerificationMethod<D, U>) -> Option<String> where
D: DID,
fn method<D, U>(method: &VerificationMethod<D, U>) -> Option<String> where
D: DID,
Returns an absolute or relative method URI, if any, depending on the MethodUriType
. Read more
sourcefn try_method<D, U>(method: &VerificationMethod<D, U>) -> Result<String, Error> where
D: DID,
fn try_method<D, U>(method: &VerificationMethod<D, U>) -> Result<String, Error> where
D: DID,
Returns String representation of absolute or relative method URI. Read more
impl StructuralPartialEq for IotaDocument
Auto Trait Implementations
impl RefUnwindSafe for IotaDocument
impl Send for IotaDocument
impl Sync for IotaDocument
impl Unpin for IotaDocument
impl UnwindSafe for IotaDocument
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<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