pub enum Line {
Record(Box<Record>),
Unknown {
position: u64,
kind: String,
},
}Expand description
One line of the log, as this build reads it.
Variants§
Record(Box<Record>)
Unknown
A record of a kind that this build does not know. A replay skips it, and logs a warning with its position.
Implementations§
Source§impl Line
impl Line
Sourcepub fn parse(line: &str) -> Result<Line, String>
pub fn parse(line: &str) -> Result<Line, String>
Reads one line of the log. A record of a kind that this build does
not know is Line::Unknown. A line that does not read is an
error. The record keeps its call ID, so a start from the log keeps
each call.
use riff_core::record::Line;
let called = r#"{"position":3,"written_at_ms":1,"call":"c1","change":{"member_invited":{"email":"a@acme.io"}}}"#;
let Line::Record(record) = Line::parse(called).unwrap() else { panic!("a known kind") };
assert_eq!(record.envelope.call.as_deref(), Some("c1"));
let later = r#"{"position":9,"written_at_ms":1,"change":{"reacted":{"emoji":"+1"}}}"#;
assert_eq!(
Line::parse(later).unwrap(),
Line::Unknown { position: 9, kind: "reacted".into() }
);
assert!(Line::parse(r#"{"position":9}"#).is_err());
assert!(Line::parse(r#"{"position":9,"written_at_ms":1,"change":{"claimed":{}}}"#).is_err());Trait Implementations§
impl Eq for Line
impl StructuralPartialEq for Line
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnsafeUnpin for Line
impl UnwindSafe for Line
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.