pub struct Source {
pub id: Option<String>,
pub resource: Option<String>,
pub title: Option<String>,
pub author: Option<Actor>,
pub usage_count: Option<i64>,
pub last_modified: Option<DateTimeField>,
pub usage_window: Option<UsageWindow>,
}Expand description
One entry in the sources list: a material the concept derives from.
Fields§
§id: Option<String>A stable key used to attribute individual claims. SHOULD be present when the body cites the source.
resource: Option<String>REQUIRED within an entry: a concrete artifact or a scope descriptor.
title: Option<String>Human-readable label for the source.
Who or what produced the source, in the actor convention. An authority signal.
usage_count: Option<i64>How often resource was exercised over the usage window. An adoption
and liveness signal: coarse, and not a cross-kind ranking.
last_modified: Option<DateTimeField>When the source itself last changed. A recency signal, distinct from
generated.at (which records when the concept was written).
usage_window: Option<UsageWindow>An entry-level override of the shared usage_window.
Implementations§
Source§impl Source
impl Source
Sourcepub fn from_value(value: &Value) -> Option<Self>
pub fn from_value(value: &Value) -> Option<Self>
Reads one sources entry. Returns None when the value is not a
mapping.
Sourcepub fn list_from_value(value: &Value) -> Vec<Self>
pub fn list_from_value(value: &Value) -> Vec<Self>
Reads a whole sources value into a list of entries.
A bare mapping is accepted as a one-element list, mirroring the rule
the spec states for verified; any other shape yields an empty list.
Sourcepub fn resource_kind(&self) -> ResourceKind
pub fn resource_kind(&self) -> ResourceKind
Classifies Source::resource.
Distinguishing a path from a scope descriptor is a heuristic (the spec
gives no syntax for either), so a resource containing whitespace is read
as a scope descriptor (all queries in BigQuery project X) and anything
else as a path. Consumers that only follow ResourceKind::Path
resources therefore never chase prose.
Sourcepub fn effective_usage_window<'a>(
&'a self,
shared: Option<&'a UsageWindow>,
) -> Option<&'a UsageWindow>
pub fn effective_usage_window<'a>( &'a self, shared: Option<&'a UsageWindow>, ) -> Option<&'a UsageWindow>
The usage window that frames this entry’s usage_count: its own if it
has one, otherwise the shared sibling of sources.