pub struct Thread {
pub thid: String,
pub pthid: String,
pub sender_order: Option<usize>,
pub received_orders: Option<HashMap<String, usize>>,
pub goal_code: Option<String>,
}Expand description
A ~thread message decorator that provides request/reply
and threading semantics according to Aries RFC 0008.
Fields§
§thid: StringThe ID of the message that serves as the thread start.
pthid: StringAn optional parent thid.
It’s used when branching or nesting a new interaction off an existing one.
sender_order: Option<usize>The index of the message in the sequence of all the messages the current sender has contributed to in the thread.
received_orders: Option<HashMap<String, usize>>A dictionary of sender_order/highest messages received on the thread.
goal_code: Option<String>Code to convey an action.
Implementations§
Source§impl Thread
impl Thread
Sourcepub fn implicit(message_id: &str) -> Self
pub fn implicit(message_id: &str) -> Self
Creates implicit thread.
§Example
use co_didcomm::Thread;
let message_id = "new-message";
let thread = Thread::implicit(&message_id);
assert_eq!(thread.thid, message_id.to_string())Sourcepub fn implicit_reply(thid: &str) -> Self
pub fn implicit_reply(thid: &str) -> Self
Create implicit message reply thread.
§Example
use co_didcomm::Thread;
let thid = "current-thread";
let thread = Thread::implicit_reply(&thid);
assert_eq!(thread.thid, thid);Sourcepub fn effective_implicit_reply(thid: &str, sender: &str) -> Self
pub fn effective_implicit_reply(thid: &str, sender: &str) -> Self
Creates an effective implicit message reply thread.
Sourcepub fn is_implicit_reply(&self, message_id: &str) -> bool
pub fn is_implicit_reply(&self, message_id: &str) -> bool
Returns true if the thread is for an implicit reply message.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Thread
impl<'de> Deserialize<'de> for Thread
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Thread
impl StructuralPartialEq for Thread
Auto Trait Implementations§
impl Freeze for Thread
impl RefUnwindSafe for Thread
impl Send for Thread
impl Sync for Thread
impl Unpin for Thread
impl UnsafeUnpin for Thread
impl UnwindSafe for Thread
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more