pub struct ThreadName(/* private fields */);Expand description
The name of a thread.
Implementations§
Source§impl ThreadName
impl ThreadName
Sourcepub fn chat() -> Self
pub fn chat() -> Self
The chat thread of riff chat.
assert_eq!(riff_core::name::ThreadName::chat().to_string(), "chat");Sourcepub fn direct(a: &Who, b: &Who) -> Self
pub fn direct(a: &Who, b: &Who) -> Self
The thread that holds the direct messages between two sessions. The order of the two sessions does not matter.
use riff_core::name::{ThreadName, Who};
let a = Who::new("mike", Some("a6cf"))?;
let b = Who::new("brett", Some("77e0"))?;
assert_eq!(ThreadName::direct(&a, &b), ThreadName::direct(&b, &a));Sourcepub fn peer(&self, who: &Who) -> Option<Who>
pub fn peer(&self, who: &Who) -> Option<Who>
The other session of a direct thread of who. None when this
is not a direct thread of who.
use riff_core::name::{ThreadName, Who};
let a = Who::new("mike", Some("a6cf"))?;
let b = Who::new("brett", Some("77e0"))?;
let c = Who::new("mike", None)?;
let thread = ThreadName::direct(&a, &b);
assert_eq!(thread.peer(&a), Some(b.clone()));
assert_eq!(thread.peer(&b), Some(a.clone()));
assert_eq!(thread.peer(&c), None);
assert_eq!(ThreadName::direct(&c, &a).peer(&a), Some(c));Trait Implementations§
Source§impl Clone for ThreadName
impl Clone for ThreadName
Source§fn clone(&self) -> ThreadName
fn clone(&self) -> ThreadName
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThreadName
impl Debug for ThreadName
Source§impl<'de> Deserialize<'de> for ThreadName
impl<'de> Deserialize<'de> for ThreadName
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
Source§impl Display for ThreadName
impl Display for ThreadName
Source§impl From<ThreadName> for String
impl From<ThreadName> for String
Source§fn from(name: ThreadName) -> Self
fn from(name: ThreadName) -> Self
Converts to this type from the input type.
Source§impl FromStr for ThreadName
impl FromStr for ThreadName
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a thread name that a person or an agent typed. Direct-message
threads come only from ThreadName::direct.
use riff_core::name::ThreadName;
assert!("como-technologies/riff".parse::<ThreadName>().is_ok());
assert!("two words".parse::<ThreadName>().is_err());
assert!("dm:someone".parse::<ThreadName>().is_err());Source§impl Hash for ThreadName
impl Hash for ThreadName
Source§impl JsonSchema for ThreadName
impl JsonSchema for ThreadName
Source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for ThreadName
impl Ord for ThreadName
Source§fn cmp(&self, other: &ThreadName) -> Ordering
fn cmp(&self, other: &ThreadName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ThreadName
impl PartialEq for ThreadName
Source§impl PartialOrd for ThreadName
impl PartialOrd for ThreadName
Source§impl Serialize for ThreadName
impl Serialize for ThreadName
Source§impl TryFrom<String> for ThreadName
impl TryFrom<String> for ThreadName
impl Eq for ThreadName
impl StructuralPartialEq for ThreadName
Auto Trait Implementations§
impl Freeze for ThreadName
impl RefUnwindSafe for ThreadName
impl Send for ThreadName
impl Sync for ThreadName
impl Unpin for ThreadName
impl UnsafeUnpin for ThreadName
impl UnwindSafe for ThreadName
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.