finance_query/models/news/
scraped.rs

1//! Scraped news article model.
2
3use serde::{Deserialize, Serialize};
4
5/// A news article
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[cfg_attr(feature = "dataframe", derive(crate::ToDataFrame))]
8#[non_exhaustive]
9pub struct News {
10    /// Article title
11    pub title: String,
12
13    /// Article URL
14    pub link: String,
15
16    /// News source/publisher (e.g., "Reuters", "Bloomberg")
17    pub source: String,
18
19    /// Thumbnail image URL
20    pub img: String,
21
22    /// Relative time when the news was published (e.g., "1 hour ago", "2 days ago")
23    pub time: String,
24}
25
26impl News {
27    /// Create a new News article
28    pub(crate) fn new(
29        title: String,
30        link: String,
31        source: String,
32        img: String,
33        time: String,
34    ) -> Self {
35        Self {
36            title,
37            link,
38            source,
39            img,
40            time,
41        }
42    }
43}