Struct identity_iota::client::IntegrationChain
source · [−]pub struct IntegrationChain { /* private fields */ }
Expand description
Primary chain of full ResolvedIotaDocuments
holding the latest version
of a DID document and its history.
See also DocumentChain
and DiffChain
.
Implementations
sourceimpl IntegrationChain
impl IntegrationChain
sourcepub async fn try_from_messages(
did: &IotaDID,
messages: &[Message],
client: &Client
) -> Result<IntegrationChain, Error>
pub async fn try_from_messages(
did: &IotaDID,
messages: &[Message],
client: &Client
) -> Result<IntegrationChain, Error>
Constructs a new IntegrationChain
from a slice of Message
s.
sourcepub async fn try_from_index(
index: MessageIndex<ResolvedIotaDocument>,
client: &Client
) -> Result<IntegrationChain, Error>
pub async fn try_from_index(
index: MessageIndex<ResolvedIotaDocument>,
client: &Client
) -> Result<IntegrationChain, Error>
Constructs a new IntegrationChain
from the given MessageIndex
.
sourcepub fn new(current: ResolvedIotaDocument) -> Result<IntegrationChain, Error>
pub fn new(current: ResolvedIotaDocument) -> Result<IntegrationChain, Error>
Creates a new IntegrationChain
with current
as the root ResolvedIotaDocument
and no history.
sourcepub fn current(&self) -> &ResolvedIotaDocument
pub fn current(&self) -> &ResolvedIotaDocument
Returns a reference to the latest ResolvedIotaDocument
.
sourcepub fn current_mut(&mut self) -> &mut ResolvedIotaDocument
pub fn current_mut(&mut self) -> &mut ResolvedIotaDocument
Returns a mutable reference to the latest ResolvedIotaDocument
.
sourcepub fn current_message_id(&self) -> &MessageId
pub fn current_message_id(&self) -> &MessageId
Returns the Tangle message id of the latest integration ResolvedIotaDocument
.
sourcepub fn history(&self) -> Option<&[ResolvedIotaDocument]>
pub fn history(&self) -> Option<&[ResolvedIotaDocument]>
Returns a slice of ResolvedIotaDocuments
in the integration chain, if present.
This excludes the current document.
sourcepub fn try_push(&mut self, document: ResolvedIotaDocument) -> Result<(), Error>
pub fn try_push(&mut self, document: ResolvedIotaDocument) -> Result<(), Error>
Adds a new ResolvedIotaDocument
to this IntegrationChain
.
Errors
Fails if the ResolvedIotaDocument
is not a valid addition.
See IntegrationChain::check_valid_addition
.
sourcepub fn is_valid_addition(&self, document: &ResolvedIotaDocument) -> bool
pub fn is_valid_addition(&self, document: &ResolvedIotaDocument) -> bool
Returns true
if the ResolvedIotaDocument
can be added to this IntegrationChain
.
sourcepub fn check_valid_addition(
&self,
document: &ResolvedIotaDocument
) -> Result<(), Error>
pub fn check_valid_addition(
&self,
document: &ResolvedIotaDocument
) -> Result<(), Error>
Checks if the ResolvedIotaDocument
can be added to this IntegrationChain
.
NOTE: the checks here are not exhaustive (e.g. the document message_id
is not verified to
have been published and contain the same contents on the Tangle).
Errors
Fails if the document signature is invalid or the Tangle message
references within the ResolvedIotaDocument
are invalid.
Trait Implementations
sourceimpl Clone for IntegrationChain
impl Clone for IntegrationChain
sourcefn clone(&self) -> IntegrationChain
fn clone(&self) -> IntegrationChain
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 IntegrationChain
impl Debug for IntegrationChain
sourceimpl<'de> Deserialize<'de> for IntegrationChain
impl<'de> Deserialize<'de> for IntegrationChain
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<IntegrationChain, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<IntegrationChain, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for IntegrationChain
impl Display for IntegrationChain
sourceimpl From<IntegrationChain> for Vec<ResolvedIotaDocument, Global>
impl From<IntegrationChain> for Vec<ResolvedIotaDocument, Global>
Convert an IntegrationChain
into an ordered list of documents with the current document
as the last entry.
sourceimpl Serialize for IntegrationChain
impl Serialize for IntegrationChain
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
Auto Trait Implementations
impl RefUnwindSafe for IntegrationChain
impl Send for IntegrationChain
impl Sync for IntegrationChain
impl Unpin for IntegrationChain
impl UnwindSafe for IntegrationChain
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