pub struct HackerNewsItem {Show 15 fields
pub id: u32,
pub deleted: Option<bool>,
pub response_type: Option<String>,
pub by: Option<String>,
pub created_at: OffsetDateTime,
pub dead: Option<bool>,
pub parent: Option<u32>,
pub poll: Option<u32>,
pub kids: Option<Vec<u32>>,
pub url: Option<String>,
pub score: Option<u32>,
pub title: Option<String>,
pub text: Option<String>,
pub parts: Option<Vec<u32>>,
pub descendants: Option<u32>,
}
Expand description
Represents a Hacker News item returned from the item endpoint.
Fields§
§id: u32
The item’s unique id.
deleted: Option<bool>
Flag representing item state, true if the item is deleted.
response_type: Option<String>
The type of item. One of “job”, “story”, “comment”, “poll”, or “pollopt”.
by: Option<String>
The username of the item’s author.
created_at: OffsetDateTime
Creation date of the item, in Unix Time.
dead: Option<bool>
Flag representing active state, true if the item is dead.
parent: Option<u32>
The comment’s parent: either another comment or the relevant story.
poll: Option<u32>
The pollopt’s associated poll.
kids: Option<Vec<u32>>
The ids of the item’s comments, in ranked display order.
url: Option<String>
The URL of the story.
score: Option<u32>
The story’s score, or the votes for a pollopt.
title: Option<String>
The title of the story, poll or job. HTML.
text: Option<String>
The comment, story or poll text. HTML.
parts: Option<Vec<u32>>
A list of related pollopts, in display order.
descendants: Option<u32>
In the case of stories or polls, the total comment count.
Implementations§
Source§impl HackerNewsItem
impl HackerNewsItem
Sourcepub fn get_item_type(&self) -> HackerNewsItemType
pub fn get_item_type(&self) -> HackerNewsItemType
Returns a typed variant of the item type based on the response item.
Sourcepub fn is_comment(&self) -> bool
pub fn is_comment(&self) -> bool
Determines if the item type is a comment.
Sourcepub fn is_pollopt(&self) -> bool
pub fn is_pollopt(&self) -> bool
Determines if the item type is a poll option.