Skip to main content

SafetyEventLog

Struct SafetyEventLog 

Source
pub struct SafetyEventLog { /* private fields */ }
Expand description

Append-only, plaintext, hash-linked safety event ledger. Reuses the black-box chain semantics ([entry_hash], genesis_prev_hash) so the two logs verify the same way, but entries are plaintext: a safety record is meant to be read and trusted by third parties.

Implementations§

Source§

impl SafetyEventLog

Source

pub fn new(genesis_prev_hash_override: Option<&str>) -> Self

Build a log. A None genesis uses genesis_prev_hash.

Source

pub fn resume(prev_hash: &str, next_seq: u64) -> Self

Continue a log whose head is prev_hash and whose next entry is number next_seq (a host that keeps the log itself appends one entry at a time this way).

Source

pub fn append( &mut self, event_type: &str, severity: &str, details: Option<&Value>, actor: Option<&str>, timestamp: &str, ) -> Result<Value>

Append one safety event, link it to the chain head, and return the entry.

Source

pub fn head(&self) -> &str

Source

pub fn genesis(&self) -> &str

Source

pub fn entries(&self) -> &[Value]

Source

pub fn summarize(&self) -> Value

Produce a summary object for embedding in a safety-record credential.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.