pub struct Message {
pub content: MessageContents,
pub id: String,
pub is_migrated: bool,
pub last_update_time: OffsetDateTime,
pub owner_id: User,
pub read_time: Option<OffsetDateTime>,
pub recipient_id: User,
pub send_time: OffsetDateTime,
pub sender_id: User,
pub sender_user_session_id: Option<UserSession>,
}Expand description
A message between two accounts
Fields§
§content: MessageContentsThe contents of the message
id: StringAn UUID prefixed with MSG-
is_migrated: boolIf the message was from a migration
Defaults to false if missing
last_update_time: OffsetDateTimeWhen the message was sent
owner_id: UserThe owner, so most likely the logged in user
read_time: Option<OffsetDateTime>When the message was sent
recipient_id: UserIf the user is focused on this session
send_time: OffsetDateTimeWhen the message was sent
sender_id: UserThe sender of the message
sender_user_session_id: Option<UserSession>The user session ID of the sender of the message
Implementations§
Source§impl Message
impl Message
Sourcepub fn non_owner_id(&self) -> &User
pub fn non_owner_id(&self) -> &User
Gets the ID recipient’s if the owners ID doesn’t match it, otherwise the sender’s id is returned
Sourcepub fn new(
content: MessageContents,
owner_and_sender: User,
sender_user_session_id: Option<UserSession>,
recipient: User,
) -> Self
Available on crate feature rand_util only.
pub fn new( content: MessageContents, owner_and_sender: User, sender_user_session_id: Option<UserSession>, recipient: User, ) -> Self
rand_util only.Creates a new message with a random id and time set to now
Trait Implementations§
Source§impl BorshDeserialize for Message
impl BorshDeserialize for Message
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Message
impl BorshSerialize for Message
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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 Queryable<Authentication, Message> for Message
Send a message
impl Queryable<Authentication, Message> for Message
Send a message
Source§fn url(&self, _: &Authentication) -> String
fn url(&self, _: &Authentication) -> String
The URL of the request
Source§fn body(&self, _state: &Authentication) -> Option<Result<Vec<u8>>>
fn body(&self, _state: &Authentication) -> Option<Result<Vec<u8>>>
Creates a JSON body for the request Read more
Source§fn method(&self, _state: &Authentication) -> RequestMethod
fn method(&self, _state: &Authentication) -> RequestMethod
The method to use for the request Read more
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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