pub struct SourceRef {
pub source_type: SourceType,
pub url: Option<String>,
pub title: Option<String>,
pub author: Option<String>,
pub date: Option<Timestamp>,
pub notes: Option<String>,
}Expand description
Reference to source material.
Sources track the provenance of event data, enabling verification and attribution.
§Examples
use spatial_narrative::core::{SourceRef, SourceType};
let source = SourceRef::article("https://news.example.com/story");
let detailed = SourceRef::builder()
.source_type(SourceType::Report)
.url("https://gov.example.com/report.pdf")
.title("Official Incident Report")
.author("Department of Safety")
.build();Fields§
§source_type: SourceTypeType of source.
url: Option<String>URL to the source (if available).
title: Option<String>Title of the source.
Author or creator.
date: Option<Timestamp>Publication or access date.
notes: Option<String>Additional notes about the source.
Implementations§
Source§impl SourceRef
impl SourceRef
Sourcepub fn new(source_type: SourceType) -> Self
pub fn new(source_type: SourceType) -> Self
Creates a new source reference with the given type.
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Sets the title.
Sets the author.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SourceRef
impl<'de> Deserialize<'de> for SourceRef
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 Eq for SourceRef
impl StructuralPartialEq for SourceRef
Auto Trait Implementations§
impl Freeze for SourceRef
impl RefUnwindSafe for SourceRef
impl Send for SourceRef
impl Sync for SourceRef
impl Unpin for SourceRef
impl UnwindSafe for SourceRef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.