identity_iota::document

Struct CoreDocument

Source
pub struct CoreDocument { /* private fields */ }
Expand description

A DID Document.

Specification

Implementations§

Source§

impl CoreDocument

Source

pub fn builder(properties: BTreeMap<String, Value>) -> DocumentBuilder

Creates a DocumentBuilder to configure a new CoreDocument.

This is the same as DocumentBuilder::new.

Source

pub fn from_builder(builder: DocumentBuilder) -> Result<CoreDocument, Error>

Returns a new CoreDocument based on the DocumentBuilder configuration.

Source

pub fn id(&self) -> &CoreDID

Returns a reference to the CoreDocument id.

Source

pub fn id_mut_unchecked(&mut self) -> &mut CoreDID

Returns a mutable reference to the CoreDocument id.

§Warning

Changes to the identifier can drastically alter the results of Self::resolve_method, Self::resolve_service and the related DID URL dereferencing algorithm.

Source

pub fn controller(&self) -> Option<&OneOrSet<CoreDID>>

Returns a reference to the CoreDocument controller.

Source

pub fn controller_mut(&mut self) -> &mut Option<OneOrSet<CoreDID>>

Returns a mutable reference to the CoreDocument controller.

Source

pub fn also_known_as(&self) -> &OrderedSet<Url>

Returns a reference to the CoreDocument alsoKnownAs set.

Source

pub fn also_known_as_mut(&mut self) -> &mut OrderedSet<Url>

Returns a mutable reference to the CoreDocument alsoKnownAs set.

Source

pub fn verification_method(&self) -> &OrderedSet<VerificationMethod>

Returns a reference to the CoreDocument verificationMethod set.

Source

pub fn authentication(&self) -> &OrderedSet<MethodRef>

Returns a reference to the CoreDocument authentication set.

Source

pub fn assertion_method(&self) -> &OrderedSet<MethodRef>

Returns a reference to the CoreDocument assertionMethod set.

Source

pub fn key_agreement(&self) -> &OrderedSet<MethodRef>

Returns a reference to the CoreDocument keyAgreement set.

Source

pub fn capability_delegation(&self) -> &OrderedSet<MethodRef>

Returns a reference to the CoreDocument capabilityDelegation set.

Source

pub fn capability_invocation(&self) -> &OrderedSet<MethodRef>

Returns a reference to the CoreDocument capabilityInvocation set.

Source

pub fn service(&self) -> &OrderedSet<Service>

Returns a reference to the CoreDocument service set.

Source

pub fn service_mut_unchecked(&mut self) -> &mut OrderedSet<Service>

§Warning

Changing a service’s identifier can drastically alter the results of Self::resolve_service and the related DID URL dereferencing algorithm.

Source

pub fn properties(&self) -> &BTreeMap<String, Value>

Returns a reference to the custom CoreDocument properties.

Source

pub fn properties_mut_unchecked(&mut self) -> &mut BTreeMap<String, Value>

Returns a mutable reference to the custom CoreDocument properties.

§Warning

The properties returned are not checked against the standard fields in a CoreDocument. Incautious use can have undesired consequences such as key collision when attempting to serialize the document or distinct resources (such as services and methods) being identified by the same DID URL.

Source

pub fn insert_method( &mut self, method: VerificationMethod, scope: MethodScope, ) -> Result<(), Error>

Adds a new VerificationMethod to the document in the given MethodScope.

§Errors

Returns an error if a method or service with the same fragment already exists.

Source

pub fn remove_method(&mut self, did_url: &DIDUrl) -> Option<VerificationMethod>

Removes and returns the VerificationMethod identified by did_url from the document.

§Note

All references to the method found in the document will be removed. This includes cases where the reference is to a method contained in another DID document.

Source

pub fn remove_method_and_scope( &mut self, did_url: &DIDUrl, ) -> Option<(VerificationMethod, MethodScope)>

Removes and returns the VerificationMethod from the document. The MethodScope under which the method was found is appended to the second position of the returned tuple.

§Note

All references to the method found in the document will be removed. This includes cases where the reference is to a method contained in another DID document.

Source

pub fn insert_service(&mut self, service: Service) -> Result<(), Error>

Adds a new Service to the document.

§Errors

Returns an error if there already exists a service or verification method with the same identifier.

Source

pub fn remove_service(&mut self, id: &DIDUrl) -> Option<Service>

Removes and returns a Service from the document if it exists.

Source

pub fn attach_method_relationship<'query, Q>( &mut self, method_query: Q, relationship: MethodRelationship, ) -> Result<bool, Error>
where Q: Into<DIDUrlQuery<'query>>,

Attaches the relationship to the method resolved by method_query.

§Errors

Returns an error if the method does not exist or if it is embedded. To convert an embedded method into a generic verification method, remove it first and insert it with MethodScope::VerificationMethod.

Source

pub fn detach_method_relationship<'query, Q>( &mut self, method_query: Q, relationship: MethodRelationship, ) -> Result<bool, Error>
where Q: Into<DIDUrlQuery<'query>>,

Detaches the relationship from the method resolved by method_query. Returns true if the relationship was found and removed, false otherwise.

§Errors

Returns an error if the method does not exist or is embedded. To remove an embedded method, use Self::remove_method.

§Note

If the method is referenced in the given scope, but the document does not contain the referenced verification method, then the reference will persist in the document (i.e. it is not removed).

Source

pub fn methods(&self, scope: Option<MethodScope>) -> Vec<&VerificationMethod>

Returns a Vec of verification method references whose verification relationship matches scope.

If scope is None, an iterator over all embedded methods is returned.

Source

pub fn verification_relationships(&self) -> impl Iterator<Item = &MethodRef>

Returns an iterator over all verification relationships.

This includes embedded and referenced VerificationMethods.

Source

pub fn resolve_method<'query, 'me, Q>( &'me self, method_query: Q, scope: Option<MethodScope>, ) -> Option<&'me VerificationMethod>
where Q: Into<DIDUrlQuery<'query>>,

Returns the first VerificationMethod with an id property matching the provided method_query and the verification relationship specified by scope if present.

Source

pub fn resolve_method_mut<'query, 'me, Q>( &'me mut self, method_query: Q, scope: Option<MethodScope>, ) -> Option<&'me mut VerificationMethod>
where Q: Into<DIDUrlQuery<'query>>,

Returns a mutable reference to the first VerificationMethod with an id property matching the provided method_query.

§Warning

Incorrect use of this method can lead to distinct document resources being identified by the same DID URL.

Source

pub fn resolve_service<'query, 'me, Q>( &'me self, service_query: Q, ) -> Option<&'me Service>
where Q: Into<DIDUrlQuery<'query>>,

Returns the first Service with an id property matching the provided service_query, if present.

Source

pub fn try_map<F, G, H, L, M, E>( self, id_update: F, controller_update: G, methods_update: H, service_update: L, error_cast: M, ) -> Result<CoreDocument, E>
where F: FnOnce(CoreDID) -> Result<CoreDID, E>, G: FnMut(CoreDID) -> Result<CoreDID, E>, H: FnMut(CoreDID) -> Result<CoreDID, E>, L: FnMut(CoreDID) -> Result<CoreDID, E>, M: FnOnce(Error) -> E,

Update the DID components of the document’s id, controllers, methods and services by applying the provided fallible maps.

This is an advanced method that can be useful for DID methods that do not know the document’s identifier prior to publishing, but should preferably be avoided otherwise.

§Errors

Any error is returned if any of the functions fail or the updates cause scoped method references to embedded methods, or methods and services with identical identifiers in the document. In the case where illegal identifiers are detected the supplied the error_cast function gets called in order to convert Error to E.

Source

pub fn map_unchecked<F, G, H, L>( self, id_update: F, controller_update: G, methods_update: H, service_update: L, ) -> CoreDocument

Unchecked version of Self::try_map.

Source§

impl CoreDocument

Source

pub fn verify_jws<'jws, T>( &self, jws: &'jws str, detached_payload: Option<&'jws [u8]>, signature_verifier: &T, options: &JwsVerificationOptions, ) -> Result<DecodedJws<'jws>, Error>
where T: JwsVerifier,

Decodes and verifies the provided JWS according to the passed JwsVerificationOptions and JwsVerifier.

Regardless of which options are passed the following conditions must be met in order for a verification attempt to take place.

  • The JWS must be encoded according to the JWS compact serialization.
  • The kid value in the protected header must be an identifier of a verification method in this DID document, or set explicitly in the options.
Source§

impl CoreDocument

Source

pub fn expand_did_jwk(did_jwk: DIDJwk) -> Result<CoreDocument, Error>

Creates a CoreDocument from a did:jwk DID.

Trait Implementations§

Source§

impl AsRef<CoreDocument> for CoreDocument

Source§

fn as_ref(&self) -> &CoreDocument

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CoreDocument> for IotaDocument

Source§

fn as_ref(&self) -> &CoreDocument

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for CoreDocument

Source§

fn clone(&self) -> CoreDocument

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CoreDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CoreDocument

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<CoreDocument, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CoreDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<CoreDocument> for IotaDocument

Source§

fn from(value: CoreDocument) -> IotaDocument

Converts to this type from the input type.
Source§

impl From<IotaDocument> for CoreDocument

Source§

fn from(document: IotaDocument) -> CoreDocument

Converts to this type from the input type.
Source§

impl JwkDocumentExt for CoreDocument

Source§

fn generate_method<'life0, 'life1, 'life2, 'async_trait, K, I>( &'life0 mut self, storage: &'life1 Storage<K, I>, key_type: KeyType, alg: JwsAlgorithm, fragment: Option<&'life2 str>, scope: MethodScope, ) -> Pin<Box<dyn Future<Output = Result<String, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, K: JwkStorage + 'async_trait, I: KeyIdStorage + 'async_trait, CoreDocument: 'async_trait,

Generate new key material in the given storage and insert a new verification method with the corresponding public key material into the DID document. Read more
Source§

fn purge_method<'life0, 'life1, 'life2, 'async_trait, K, I>( &'life0 mut self, storage: &'life1 Storage<K, I>, id: &'life2 DIDUrl, ) -> Pin<Box<dyn Future<Output = Result<(), JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, K: JwkStorage + 'async_trait, I: KeyIdStorage + 'async_trait, CoreDocument: 'async_trait,

Remove the method identified by the given id from the document and delete the corresponding key material in the given storage. Read more
Source§

fn create_jws<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait, K, I>( &'life0 self, storage: &'life1 Storage<K, I>, fragment: &'life2 str, payload: &'life3 [u8], options: &'life4 JwsSignatureOptions, ) -> Pin<Box<dyn Future<Output = Result<Jws, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, K: JwkStorage + 'async_trait, I: KeyIdStorage + 'async_trait, CoreDocument: 'async_trait,

Sign the arbitrary payload according to options with the storage backed private key corresponding to the public key material in the verification method identified by the given `fragment. Read more
Source§

fn create_credential_jwt<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait, K, I, T>( &'life0 self, credential: &'life1 Credential<T>, storage: &'life2 Storage<K, I>, fragment: &'life3 str, options: &'life4 JwsSignatureOptions, custom_claims: Option<BTreeMap<String, Value>>, ) -> Pin<Box<dyn Future<Output = Result<Jwt, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, K: JwkStorage + 'async_trait, I: KeyIdStorage + 'async_trait, T: ToOwned<Owned = T> + Serialize + DeserializeOwned + Sync + 'async_trait, CoreDocument: 'async_trait,

Produces a JWT where the payload is produced from the given credential in accordance with VC Data Model v1.1. Read more
Source§

fn create_presentation_jwt<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait, K, I, CRED, T>( &'life0 self, presentation: &'life1 Presentation<CRED, T>, storage: &'life2 Storage<K, I>, fragment: &'life3 str, jws_options: &'life4 JwsSignatureOptions, jwt_options: &'life5 JwtPresentationOptions, ) -> Pin<Box<dyn Future<Output = Result<Jwt, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, K: JwkStorage + 'async_trait, I: KeyIdStorage + 'async_trait, T: ToOwned<Owned = T> + Serialize + DeserializeOwned + Sync + 'async_trait, CRED: ToOwned<Owned = CRED> + Serialize + DeserializeOwned + Clone + Sync + 'async_trait, CoreDocument: 'async_trait,

Produces a JWT where the payload is produced from the given presentation in accordance with VC Data Model v1.1. Read more
Source§

impl JwpDocumentExt for CoreDocument

Source§

fn generate_method_jwp<'life0, 'life1, 'life2, 'async_trait, K, I>( &'life0 mut self, storage: &'life1 Storage<K, I>, key_type: KeyType, alg: ProofAlgorithm, fragment: Option<&'life2 str>, scope: MethodScope, ) -> Pin<Box<dyn Future<Output = Result<String, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, K: JwkStorageBbsPlusExt + 'async_trait, I: KeyIdStorage + 'async_trait, CoreDocument: 'async_trait,

Generate new key material in the given storage and insert a new verification method with the corresponding public key material into the DID document. This supports BBS+ keys.
Source§

fn create_issued_jwp<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait, K, I>( &'life0 self, storage: &'life1 Storage<K, I>, fragment: &'life2 str, jpt_claims: &'life3 JptClaims, options: &'life4 JwpCredentialOptions, ) -> Pin<Box<dyn Future<Output = Result<String, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, K: JwkStorageBbsPlusExt + 'async_trait, I: KeyIdStorage + 'async_trait, CoreDocument: 'async_trait,

Compute a JWP in the Issued form representing the Verifiable Credential See JSON Web Proof draft
Source§

fn create_presented_jwp<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, presentation: &'life1 mut SelectiveDisclosurePresentation, method_id: &'life2 str, options: &'life3 JwpPresentationOptions, ) -> Pin<Box<dyn Future<Output = Result<String, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, CoreDocument: 'async_trait,

Compute a JWP in the Presented form representing the presented Verifiable Credential after the Selective Disclosure of attributes See JSON Web Proof draft
Source§

fn create_credential_jpt<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait, K, I, T>( &'life0 self, credential: &'life1 Credential<T>, storage: &'life2 Storage<K, I>, fragment: &'life3 str, options: &'life4 JwpCredentialOptions, custom_claims: Option<BTreeMap<String, Value>>, ) -> Pin<Box<dyn Future<Output = Result<Jpt, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, K: JwkStorageBbsPlusExt + 'async_trait, I: KeyIdStorage + 'async_trait, T: ToOwned<Owned = T> + Serialize + DeserializeOwned + Sync + 'async_trait, CoreDocument: 'async_trait,

Produces a JPT where the payload is produced from the given credential.
Source§

fn create_presentation_jpt<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, presentation: &'life1 mut SelectiveDisclosurePresentation, method_id: &'life2 str, options: &'life3 JwpPresentationOptions, ) -> Pin<Box<dyn Future<Output = Result<Jpt, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, CoreDocument: 'async_trait,

Produces a JPT where the payload contains the Selective Disclosed attributes of a credential.
Source§

impl PartialEq for CoreDocument

Source§

fn eq(&self, other: &CoreDocument) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RevocationDocumentExt for CoreDocument

Source§

fn revoke_credentials<'query, 'me, Q>( &'me mut self, service_query: Q, indices: &[u32], ) -> Result<(), RevocationError>
where Q: Into<DIDUrlQuery<'query>>,

If the document has a RevocationBitmap service identified by service_query, revoke all specified indices.
Source§

fn unrevoke_credentials<'query, 'me, Q>( &mut self, service_query: Q, indices: &[u32], ) -> Result<(), RevocationError>
where Q: Into<DIDUrlQuery<'query>>,

If the document has a RevocationBitmap service identified by service_query, unrevoke all specified indices.
Source§

fn resolve_revocation_bitmap( &self, query: DIDUrlQuery<'_>, ) -> Result<RevocationBitmap, RevocationError>

Extracts the RevocationBitmap from the referenced service in the DID Document. Read more
Source§

impl Serialize for CoreDocument

Source§

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
Source§

impl TimeframeRevocationExtension for CoreDocument

Source§

fn update<'life0, 'life1, 'life2, 'life3, 'async_trait, K, I>( &'life0 self, storage: &'life1 Storage<K, I>, fragment: &'life2 str, start_validity: Option<Timestamp>, duration: Duration, credential_jwp: &'life3 mut JwpIssued, ) -> Pin<Box<dyn Future<Output = Result<Jpt, JwkStorageDocumentError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, K: JwkStorageBbsPlusExt + 'async_trait, I: KeyIdStorage + 'async_trait, CoreDocument: 'async_trait,

Update Credential’ signature considering the Timeframe interval
Source§

impl TryFrom<CoreDocumentData> for CoreDocument

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( value: CoreDocumentData, ) -> Result<CoreDocument, <CoreDocument as TryFrom<CoreDocumentData>>::Error>

Performs the conversion.
Source§

impl Eq for CoreDocument

Source§

impl StructuralPartialEq for CoreDocument

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> ConvertTo<T> for T
where T: Send,

§

fn convert(self) -> Result<T, Error>

§

fn convert_unchecked(self) -> T

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> FmtJson for T
where T: ToJson,

Source§

fn fmt_json(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Format this as a JSON string or pretty-JSON string based on whether the # format flag was used.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromJson for T
where T: for<'de> Deserialize<'de>,

Source§

fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>

Deserialize Self from a string of JSON text.
Source§

fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>

Deserialize Self from bytes of JSON text.
Source§

fn from_json_value(json: Value) -> Result<Self, Error>

Deserialize Self from a serde_json::Value.
§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a Request
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToJson for T
where T: Serialize,

Source§

fn to_json(&self) -> Result<String, Error>

Serialize self as a string of JSON.
Source§

fn to_json_vec(&self) -> Result<Vec<u8>, Error>

Serialize self as a JSON byte vector.
Source§

fn to_json_value(&self) -> Result<Value, Error>

Serialize self as a serde_json::Value.
Source§

fn to_json_pretty(&self) -> Result<String, Error>

Serialize self as a pretty-printed string of JSON.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> ToStringFallible for T
where T: Display,

§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSendSync for T

Source§

impl<T> OptionalSend for T
where T: Send,

Source§

impl<T> OptionalSync for T
where T: Sync,