pub struct StagedEvent {
pub id: String,
pub source: String,
pub content: String,
pub meta: Option<String>,
pub timestamp: i64,
}Fields§
§id: String§source: String§content: String§meta: Option<String>§timestamp: i64Implementations§
Source§impl StagedEvent
impl StagedEvent
pub fn new(source: &str, content: &str, meta: Option<&str>) -> Self
Sourcepub fn timestamp_utc(&self) -> DateTime<Utc>
pub fn timestamp_utc(&self) -> DateTime<Utc>
Return the event timestamp as a DateTime<Utc>.
Sourcepub fn save_to_file(&self, staging_dir: &Path) -> Result<(), Error>
pub fn save_to_file(&self, staging_dir: &Path) -> Result<(), Error>
Persist this staged event to disk as a JSON file.
Sourcepub fn load_from_file(id: &str, staging_dir: &Path) -> Result<Self, Error>
pub fn load_from_file(id: &str, staging_dir: &Path) -> Result<Self, Error>
Load a staged event by its ID from the staging directory.
Sourcepub fn from_file(path: &Path) -> Result<Self, Error>
pub fn from_file(path: &Path) -> Result<Self, Error>
Load a staged event from an arbitrary file path.
Trait Implementations§
Source§impl Clone for StagedEvent
impl Clone for StagedEvent
Source§fn clone(&self) -> StagedEvent
fn clone(&self) -> StagedEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StagedEvent
impl Debug for StagedEvent
Source§impl<'de> Deserialize<'de> for StagedEvent
impl<'de> Deserialize<'de> for StagedEvent
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
Auto Trait Implementations§
impl Freeze for StagedEvent
impl RefUnwindSafe for StagedEvent
impl Send for StagedEvent
impl Sync for StagedEvent
impl Unpin for StagedEvent
impl UnsafeUnpin for StagedEvent
impl UnwindSafe for StagedEvent
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