#[non_exhaustive]pub struct Briefing {
pub source: String,
pub generated_at: Option<DateTime<Utc>>,
pub narrative: Option<String>,
pub products: Vec<Product>,
}Expand description
A completed weather briefing.
Sources differ in shape: product-oriented APIs fill Self::products,
document-oriented services (one rendered briefing text) fill
Self::narrative. Either may be empty, both may be present.
#[non_exhaustive]: construct with Briefing::new and the with_*
setters.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source: Stringcrate::ContextProvider::name of the producing source.
generated_at: Option<DateTime<Utc>>When the briefing was generated, if the source reports it.
narrative: Option<String>Single-document briefing text, for document-oriented sources.
products: Vec<Product>Discrete products, for product-oriented sources.
Implementations§
Source§impl Briefing
impl Briefing
Sourcepub fn new(source: impl Into<String>) -> Self
pub fn new(source: impl Into<String>) -> Self
An empty briefing attributed to source; fill it with the with_*
setters.
Sourcepub fn with_generated_at(self, generated_at: Option<DateTime<Utc>>) -> Self
pub fn with_generated_at(self, generated_at: Option<DateTime<Utc>>) -> Self
Set the generation time.
Sourcepub fn with_narrative(self, narrative: Option<String>) -> Self
pub fn with_narrative(self, narrative: Option<String>) -> Self
Set the single-document narrative.
Sourcepub fn with_products(self, products: Vec<Product>) -> Self
pub fn with_products(self, products: Vec<Product>) -> Self
Set the discrete products.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Briefing
impl<'de> Deserialize<'de> for Briefing
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
impl StructuralPartialEq for Briefing
Auto Trait Implementations§
impl Freeze for Briefing
impl RefUnwindSafe for Briefing
impl Send for Briefing
impl Sync for Briefing
impl Unpin for Briefing
impl UnsafeUnpin for Briefing
impl UnwindSafe for Briefing
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