pub struct CommunityNoteRatingObject {
pub community_note_rating: CommunityNoteRating,
}Expand description
§Example
use chrono::{DateTime, NaiveDateTime, Utc};
use twitter_archive::convert::date_time_iso_8601::FORMAT;
use twitter_archive::structs::community_note_rating::CommunityNoteRatingObject;
let created_at_string = "2020-01-20T21:42:09.068Z";
let created_at_native_time = NaiveDateTime::parse_from_str(&created_at_string, FORMAT).unwrap();
let created_at_date_time = DateTime::<Utc>::from_naive_utc_and_offset(created_at_native_time, Utc);
let json = format!(r#"{{
"communityNoteRating" : {{
"notHelpfulTags" : [
"OpinionSpeculation",
"NoteNotNeeded"
],
"noteId" : "9999999999999999999",
"helpfulnessLevel" : "NotHelpful",
"createdAt" : "{created_at_string}",
"userId" : "111111111"
}}
}}"#);
let data: CommunityNoteRatingObject = serde_json::from_str(&json).unwrap();
// De-serialized properties
assert_eq!(data.community_note_rating.not_helpful_tags.len(), 2);
assert_eq!(data.community_note_rating.not_helpful_tags[0], "OpinionSpeculation");
assert_eq!(data.community_note_rating.not_helpful_tags[1], "NoteNotNeeded");
assert_eq!(data.community_note_rating.note_id, "9999999999999999999");
assert_eq!(data.community_note_rating.helpfulness_level, "NotHelpful");
assert_eq!(data.community_note_rating.created_at, created_at_date_time);
assert_eq!(data.community_note_rating.user_id, "111111111");
assert_eq!(data.community_note_rating.created_at, created_at_date_time);
// Re-serialize is equivalent to original data without pretty printing
// assert_eq!(serde_json::to_string(&data).unwrap(), json.replace("\n", "").replace(" ", ""));Fields§
§community_note_rating: CommunityNoteRating§Example JSON data
{
"communityNoteRating" : {
"notHelpfulTags" : [
"OpinionSpeculation",
"NoteNotNeeded"
],
"noteId" : "9999999999999999999",
"helpfulnessLevel" : "NotHelpful",
"createdAt" : "2020-01-20T21:42:09.068Z",
"userId" : "111111111"
}
}Trait Implementations§
Source§impl Clone for CommunityNoteRatingObject
impl Clone for CommunityNoteRatingObject
Source§fn clone(&self) -> CommunityNoteRatingObject
fn clone(&self) -> CommunityNoteRatingObject
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 CommunityNoteRatingObject
impl Debug for CommunityNoteRatingObject
Source§impl<'de> Deserialize<'de> for CommunityNoteRatingObject
impl<'de> Deserialize<'de> for CommunityNoteRatingObject
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 CommunityNoteRatingObject
impl Display for CommunityNoteRatingObject
Auto Trait Implementations§
impl Freeze for CommunityNoteRatingObject
impl RefUnwindSafe for CommunityNoteRatingObject
impl Send for CommunityNoteRatingObject
impl Sync for CommunityNoteRatingObject
impl Unpin for CommunityNoteRatingObject
impl UnwindSafe for CommunityNoteRatingObject
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