pub struct Service<D = CoreDID, T = Object>where
    D: DID,{ /* private fields */ }
Expand description

A DID Document Service used to enable trusted interactions associated with a DID subject.

Specification

Implementations§

source§

impl<D, T> Service<D, T>where D: DID,

source

pub fn builder(properties: T) -> ServiceBuilder<D, T>

Creates a ServiceBuilder to configure a new Service.

This is the same as ServiceBuilder::new().

source

pub fn from_builder(builder: ServiceBuilder<D, T>) -> Result<Self>

Returns a new Service based on the ServiceBuilder configuration.

source

pub fn id(&self) -> &DIDUrl<D>

Returns a reference to the Service id.

source

pub fn set_id(&mut self, id: DIDUrl<D>) -> Result<()>

Sets the Service id.

Errors

Error::MissingIdFragment if there is no fragment on the DIDUrl.

source

pub fn type_(&self) -> &str

Returns a reference to the Service type.

source

pub fn type_mut(&mut self) -> &mut String

Returns a mutable reference to the Service type.

source

pub fn service_endpoint(&self) -> &ServiceEndpoint

Returns a reference to the Service endpoint.

source

pub fn service_endpoint_mut(&mut self) -> &mut ServiceEndpoint

Returns a mutable reference to the Service endpoint.

source

pub fn properties(&self) -> &T

Returns a reference to the custom Service properties.

source

pub fn properties_mut(&mut self) -> &mut T

Returns a mutable reference to the custom Service properties.

source

pub fn map<C, F>(self, f: F) -> Service<C, T>where C: DID, F: FnMut(D) -> C,

Maps Service<D,T> to Service<C,T> by applying a function f to the id.

source

pub fn try_map<C, F, E>(self, f: F) -> Result<Service<C, T>, E>where C: DID, F: FnMut(D) -> Result<C, E>,

Fallible version of Service::map.

Trait Implementations§

source§

impl<D, T> AsRef<DIDUrl<D>> for Service<D, T>where D: DID,

source§

fn as_ref(&self) -> &DIDUrl<D>

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

impl<D, T: Clone> Clone for Service<D, T>where D: DID + Clone,

source§

fn clone(&self) -> Service<D, T>

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<D, T: Debug> Debug for Service<D, T>where D: DID + Debug,

source§

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

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

impl<'de, D, T> Deserialize<'de> for Service<D, T>where D: DID + Deserialize<'de>, T: Deserialize<'de>,

source§

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<D, T> Diff for Service<D, T>where D: Diff + DID + Serialize + for<'de> Deserialize<'de>, T: Diff + Serialize + for<'de> Deserialize<'de> + Default,

§

type Type = DiffService<D, T>

👎Deprecated since 0.5.0: diff chain features are slated for removal
The Corresponding Diff Type for the implemented Type.
source§

fn diff(&self, other: &Self) -> Result<Self::Type>

👎Deprecated since 0.5.0: diff chain features are slated for removal
Finds the difference between two types; self and other and returns Self::Type
source§

fn merge(&self, diff: Self::Type) -> Result<Self>

👎Deprecated since 0.5.0: diff chain features are slated for removal
Merges a Self::Type with Self
source§

fn from_diff(diff: Self::Type) -> Result<Self>

👎Deprecated since 0.5.0: diff chain features are slated for removal
Converts a diff of type Self::Type to a Self.
source§

fn into_diff(self) -> Result<Self::Type>

👎Deprecated since 0.5.0: diff chain features are slated for removal
Converts a type of Self to a diff of Self::Type.
source§

impl<D, T> Display for Service<D, T>where D: DID + Serialize, T: Serialize,

source§

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

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

impl<D, T> KeyComparable for Service<D, T>where D: DID,

§

type Key = DIDUrl<D>

Key type for comparisons.
source§

fn key(&self) -> &Self::Key

Returns a reference to the key.
source§

impl<D, T: PartialEq> PartialEq<Service<D, T>> for Service<D, T>where D: DID + PartialEq,

source§

fn eq(&self, other: &Service<D, T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<D, T> Serialize for Service<D, T>where D: DID + Serialize, T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<D: DID + Sized> TryFrom<&Service<D, BTreeMap<String, Value, Global>>> for RevocationBitmap

§

type Error = Error

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

fn try_from(service: &Service<D>) -> Result<Self>

Performs the conversion.
source§

impl<D, T> StructuralPartialEq for Service<D, T>where D: DID,

Auto Trait Implementations§

§

impl<D, T> RefUnwindSafe for Service<D, T>where D: RefUnwindSafe, T: RefUnwindSafe,

§

impl<D, T> Send for Service<D, T>where D: Send, T: Send,

§

impl<D, T> Sync for Service<D, T>where D: Sync, T: Sync,

§

impl<D, T> Unpin for Service<D, T>where D: Unpin, T: Unpin,

§

impl<D, T> UnwindSafe for Service<D, T>where D: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> FmtJson for Twhere 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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

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

Deserialize Self from a string of JSON text.
source§

fn from_json_slice(json: &impl AsRef<[u8]>) -> 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.
source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToJson for Twhere 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, Global>, 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§

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

Serialize self as a JSON byte vector, normalized using JSON Canonicalization Scheme (JCS).
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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