pub struct DeviceTokenObject {
pub device_token: DeviceToken,
}Expand description
§Example
use chrono::{DateTime, NaiveDateTime, Utc};
use twitter_archive::convert::date_time_iso_8601;
use twitter_archive::structs::device_token::DeviceTokenObject;
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 last_seen_string = "2023-08-12T17:10:37.000Z";
let last_seen_native_time = NaiveDateTime::parse_from_str(&created_at_string, date_time_iso_8601::FORMAT).unwrap();
let last_seen_date_time = DateTime::<Utc>::from_naive_utc_and_offset(created_at_native_time, Utc);
let json = format!(r#"{{
"deviceToken": {{
"clientApplicationId": "1111111",
"token": "DEADBEEF",
"createdAt": "{created_at_string}",
"lastSeenAt": "{last_seen_string}",
"clientApplicationName": "Twitter Web App (Twitter. Inc)"
}}
}}"#);
let data: DeviceTokenObject = serde_json::from_str(&json).unwrap();
// De-serialized properties
assert_eq!(data.device_token.client_application_id, "1111111");
assert_eq!(data.device_token.token, "DEADBEEF");
assert_eq!(data.device_token.created_at, created_at_date_time);
assert_eq!(data.device_token.last_seen_at, last_seen_date_time);
assert_eq!(data.device_token.client_application_name, "Twitter Web App (Twitter. Inc)");
// Re-serialize is equivalent to original data without pretty printing
assert_eq!(serde_json::to_string_pretty(&data).unwrap(), json);Fields§
§device_token: DeviceToken§Example JSON data
{
"deviceToken": {
"clientApplicationId": "1111111",
"token": "DEADBEEF",
"createdAt": "2023-08-12T17:10:37.000Z",
"lastSeenAt": "2023-08-12T17:10:37.000Z",
"clientApplicationName": "Twitter Web App (Twitter. Inc)"
}
}Trait Implementations§
Source§impl Clone for DeviceTokenObject
impl Clone for DeviceTokenObject
Source§fn clone(&self) -> DeviceTokenObject
fn clone(&self) -> DeviceTokenObject
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 DeviceTokenObject
impl Debug for DeviceTokenObject
Source§impl<'de> Deserialize<'de> for DeviceTokenObject
impl<'de> Deserialize<'de> for DeviceTokenObject
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 DeviceTokenObject
impl Display for DeviceTokenObject
Auto Trait Implementations§
impl Freeze for DeviceTokenObject
impl RefUnwindSafe for DeviceTokenObject
impl Send for DeviceTokenObject
impl Sync for DeviceTokenObject
impl Unpin for DeviceTokenObject
impl UnwindSafe for DeviceTokenObject
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