pub struct MessageCreateObject {
pub message_create: MessageCreate,
}Expand description
§Example
use chrono::{DateTime, NaiveDateTime, Utc};
use twitter_archive::convert::date_time_iso_8601;
use twitter_archive::structs::direct_message_headers::MessageCreateObject;
let created_at_string = "2023-08-12T17:10:37.000Z";
let created_at_native_time = NaiveDateTime::parse_from_str(&created_at_string, date_time_iso_8601::FORMAT).unwrap();
let created_at_date_time = DateTime::<Utc>::from_naive_utc_and_offset(created_at_native_time, Utc);
let json = format!(r#"{{
"messageCreate": {{
"id": "1111111111111111111",
"senderId": "2222",
"recipientId": "1111",
"createdAt": "{created_at_string}"
}}
}}"#);
let data: MessageCreateObject = serde_json::from_str(&json).unwrap();
// De-serialized properties
assert_eq!(data.message_create.id, "1111111111111111111");
assert_eq!(data.message_create.sender_id, "2222");
assert_eq!(data.message_create.recipient_id, "1111");
assert_eq!(data.message_create.created_at, created_at_date_time);
// Re-serialize is equivalent to original data without pretty printing
assert_eq!(serde_json::to_string_pretty(&data).unwrap(), json);Fields§
§message_create: MessageCreate§Example JSON data
{
"messageCreate": {
"id": "1111111111111111111",
"senderId": "2222",
"recipientId": "1111",
"createdAt": "2023-08-12T17:10:37.000Z"
}
}Trait Implementations§
Source§impl Clone for MessageCreateObject
impl Clone for MessageCreateObject
Source§fn clone(&self) -> MessageCreateObject
fn clone(&self) -> MessageCreateObject
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 MessageCreateObject
impl Debug for MessageCreateObject
Source§impl<'de> Deserialize<'de> for MessageCreateObject
impl<'de> Deserialize<'de> for MessageCreateObject
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 MessageCreateObject
impl Display for MessageCreateObject
Auto Trait Implementations§
impl Freeze for MessageCreateObject
impl RefUnwindSafe for MessageCreateObject
impl Send for MessageCreateObject
impl Sync for MessageCreateObject
impl Unpin for MessageCreateObject
impl UnwindSafe for MessageCreateObject
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