Struct identity_iota::client::DiffChain
source · [−]pub struct DiffChain { /* private fields */ }
diff chain features are slated for removal
Implementations
sourceimpl DiffChain
impl DiffChain
sourcepub async fn try_from_messages(
integration_chain: &IntegrationChain,
messages: &[Message],
client: &Client
) -> Result<DiffChain, Error>
pub async fn try_from_messages(
integration_chain: &IntegrationChain,
messages: &[Message],
client: &Client
) -> Result<DiffChain, Error>
Constructs a new DiffChain
for the given IntegrationChain
from a slice of Messages
.
sourcepub async fn try_from_index(
integration_chain: &IntegrationChain,
index: MessageIndex<DiffMessage>,
client: &Client
) -> Result<DiffChain, Error>
pub async fn try_from_index(
integration_chain: &IntegrationChain,
index: MessageIndex<DiffMessage>,
client: &Client
) -> Result<DiffChain, Error>
Constructs a new DiffChain
for the given IntegrationChain
from the given MessageIndex
.
sourcepub fn iter(&self) -> Iter<'_, DiffMessage>
pub fn iter(&self) -> Iter<'_, DiffMessage>
Returns an iterator yielding references to DiffMessages
.
sourcepub fn current_message_id(&self) -> Option<&MessageId>
pub fn current_message_id(&self) -> Option<&MessageId>
Returns the MessageId
of the latest diff in the chain, if any.
sourcepub fn try_push_and_merge(
&mut self,
diff: DiffMessage,
integration_document: &ResolvedIotaDocument
) -> Result<ResolvedIotaDocument, Error>
pub fn try_push_and_merge(
&mut self,
diff: DiffMessage,
integration_document: &ResolvedIotaDocument
) -> Result<ResolvedIotaDocument, Error>
sourcepub fn verify_diff(
diff: &DiffMessage,
document: &ResolvedIotaDocument,
expected_prev_message_id: &MessageId
) -> Result<(), Error>
pub fn verify_diff(
diff: &DiffMessage,
document: &ResolvedIotaDocument,
expected_prev_message_id: &MessageId
) -> Result<(), Error>
Checks whether the DiffMessage
attributes and signature are valid.
NOTE: does not verify the changes contained in the diff are valid.
See DiffChain::try_merge
.
sourcepub fn try_merge(
diff: &DiffMessage,
document: &ResolvedIotaDocument
) -> Result<ResolvedIotaDocument, Error>
pub fn try_merge(
diff: &DiffMessage,
document: &ResolvedIotaDocument
) -> Result<ResolvedIotaDocument, Error>
Attempts to merge the DiffMessage
changes into the given document and returns the
resulting ResolvedIotaDocument
if valid.
NOTE: does not verify the signature and attributes.
See DiffChain::verify_diff
.
sourcepub fn check_valid_addition(
diff: &DiffMessage,
document: &ResolvedIotaDocument,
expected_prev_message_id: &MessageId
) -> Result<ResolvedIotaDocument, Error>
pub fn check_valid_addition(
diff: &DiffMessage,
document: &ResolvedIotaDocument,
expected_prev_message_id: &MessageId
) -> Result<ResolvedIotaDocument, Error>
Checks if the DiffMessage
can be added to the DiffChain
. Returns the merged
document if valid.
Equivalent to calling DiffChain::verify_diff
then DiffChain::try_merge
.
Errors
Fails if the DiffMessage
is not a valid addition.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for DiffChain
impl<'de> Deserialize<'de> for DiffChain
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<DiffChain, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<DiffChain, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for DiffChain
impl Serialize for DiffChain
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 DiffChain
impl Send for DiffChain
impl Sync for DiffChain
impl Unpin for DiffChain
impl UnwindSafe for DiffChain
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