pub struct IpAuditObject {
pub ip_audit: IpAudit,
}Expand description
§Example
use chrono::{DateTime, NaiveDateTime, Utc};
use twitter_archive::convert::date_time_iso_8601;
use twitter_archive::structs::ip_audit::IpAuditObject;
let created_at_string = "2023-05-30T13:31:42.908Z";
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#"{{
"ipAudit": {{
"accountId": "111111111",
"createdAt": "{created_at_string}",
"loginIp": "127.0.0.1"
}}
}}"#);
let data: IpAuditObject = serde_json::from_str(&json).unwrap();
// De-serialized properties
assert_eq!(data.ip_audit.account_id, "111111111");
assert_eq!(data.ip_audit.created_at, created_at_date_time);
assert_eq!(data.ip_audit.login_ip, "127.0.0.1");
// Re-serialize is equivalent to original data
assert_eq!(serde_json::to_string_pretty(&data).unwrap(), json);Fields§
§ip_audit: IpAudit§Example JSON data
{
"ipAudit": {
"accountId": "111111111",
"createdAt": "2023-05-30T13:31:42.908Z",
"loginIp": "127.0.0.1"
}
}Trait Implementations§
Source§impl Clone for IpAuditObject
impl Clone for IpAuditObject
Source§fn clone(&self) -> IpAuditObject
fn clone(&self) -> IpAuditObject
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 IpAuditObject
impl Debug for IpAuditObject
Source§impl<'de> Deserialize<'de> for IpAuditObject
impl<'de> Deserialize<'de> for IpAuditObject
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 IpAuditObject
impl Display for IpAuditObject
Auto Trait Implementations§
impl Freeze for IpAuditObject
impl RefUnwindSafe for IpAuditObject
impl Send for IpAuditObject
impl Sync for IpAuditObject
impl Unpin for IpAuditObject
impl UnwindSafe for IpAuditObject
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