pub struct Observation {
pub realtime_start: NaiveDate,
pub realtime_end: NaiveDate,
pub date: NaiveDate,
pub value: Option<f64>,
}Expand description
A single observation in a FRED series: a calendar date, its value, and the real-time period that value was current for (ALFRED — ADR-0024).
FRED transmits the value as a string and encodes a missing value as the
sentinel ".", which maps to None. Any other value parses to Some(f64);
a non-"." value that fails to parse is a deserialization error, not a
silent None (see ADR-0004 and ADR-0005).
realtime_start /
realtime_end bound the period the value was the
current one — the ALFRED dimension. For a plain latest query FRED returns
today for both; a point-in-time or vintage_dates query returns the period
the archived value held.
On serialization the value is emitted as a JSON number or null — typed
JSON for consumers, not FRED’s stringly-typed "." wire format.
Fields§
§realtime_start: NaiveDateStart of the real-time period this value was current for (ALFRED). Equal to today for a latest query; the archived vintage’s start otherwise.
realtime_end: NaiveDateEnd of the real-time period this value was current for (ALFRED). Equal to today for a latest query; the archived vintage’s end otherwise.
date: NaiveDateThe observation date. FRED dates are calendar dates with no time or zone,
which NaiveDate models exactly.
value: Option<f64>The observation value; None when FRED reports it as missing (".").
Trait Implementations§
Source§impl Clone for Observation
impl Clone for Observation
Source§fn clone(&self) -> Observation
fn clone(&self) -> Observation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Observation
impl Debug for Observation
Source§impl<'de> Deserialize<'de> for Observation
impl<'de> Deserialize<'de> for Observation
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>,
Source§impl PartialEq for Observation
impl PartialEq for Observation
Source§fn eq(&self, other: &Observation) -> bool
fn eq(&self, other: &Observation) -> bool
self and other values to be equal, and is used by ==.