Struct golgi::messages::SsbMessageValue
source · [−]pub struct SsbMessageValue {
pub previous: Option<String>,
pub author: String,
pub sequence: u64,
pub timestamp: f64,
pub hash: String,
pub content: Value,
pub signature: String,
}
Expand description
The value
of an SSB message (the V
in KVT
).
More information concerning the data model can be found in the
Metadata
documentation.
Fields
previous: Option<String>
sequence: u64
timestamp: f64
hash: String
content: Value
signature: String
Implementations
sourceimpl SsbMessageValue
impl SsbMessageValue
sourcepub fn get_message_type(&self) -> Result<SsbMessageContentType, GolgiError>
pub fn get_message_type(&self) -> Result<SsbMessageContentType, GolgiError>
Get the type field of the message content as an enum, if found.
If no type
field is found or the type
field is not a string,
it returns an Err(GolgiError::ContentType)
.
If a type
field is found but with an unknown string,
it returns an Ok(SsbMessageContentType::Unrecognized)
.
sourcepub fn is_message_type(&self, _message_type: SsbMessageContentType) -> bool
pub fn is_message_type(&self, _message_type: SsbMessageContentType) -> bool
Helper function which returns true
if this message is of the given type,
and false
if the type does not match or is not found.
sourcepub fn into_ssb_message_content(self) -> Result<SsbMessageContent, GolgiError>
pub fn into_ssb_message_content(self) -> Result<SsbMessageContent, GolgiError>
Convert the content JSON value into an SsbMessageContent
enum
,
using the type
field as a tag to select which variant of the enum
to deserialize into.
See the Serde docs on internally-tagged enum representations for further details.
Trait Implementations
sourceimpl Debug for SsbMessageValue
impl Debug for SsbMessageValue
sourceimpl<'de> Deserialize<'de> for SsbMessageValue
impl<'de> Deserialize<'de> for SsbMessageValue
sourcefn 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
sourceimpl Serialize for SsbMessageValue
impl Serialize for SsbMessageValue
Auto Trait Implementations
impl RefUnwindSafe for SsbMessageValue
impl Send for SsbMessageValue
impl Sync for SsbMessageValue
impl Unpin for SsbMessageValue
impl UnwindSafe for SsbMessageValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more