Trait StatusTracker

Source
pub trait StatusTracker: Debug + Send {
    // Required methods
    fn logged_items(&self) -> &[LogItem];
    fn add_non_error(&mut self, log_item: LogItem);
    fn add_error<E>(&mut self, log_item: LogItem, err: E) -> Result<(), E>;

    // Provided methods
    fn append(&mut self, other: &impl StatusTracker) { ... }
    fn filter_errors(&mut self) -> impl Iterator<Item = &LogItem> { ... }
    fn has_status(&self, val: &str) -> bool { ... }
    fn has_error<E: Debug>(&self, err: E) -> bool { ... }
    fn push_ingredient_uri<S: Into<String>>(&mut self, _uri: S) { ... }
    fn pop_ingredient_uri(&mut self) -> Option<String> { ... }
}
Expand description

A StatusTracker is used in the validation logic of c2pa-rs and related crates to control error-handling behavior and optionally aggregate log messages as they are generated.

Required Methods§

Source

fn logged_items(&self) -> &[LogItem]

Return the current list of validation log items.

Source

fn add_non_error(&mut self, log_item: LogItem)

Add a non-error LogItem to this status tracker.

Primarily intended for use by LogItem::success() or LogItem::informational().

Source

fn add_error<E>(&mut self, log_item: LogItem, err: E) -> Result<(), E>

Add an error-case LogItem to this status tracker.

Some implementations are configured to stop immediately on errors. If so, this function will return Err(err).

If the implementation is configured to aggregate all log messages, this function returns Ok(()).

Primarily intended for use by LogItem::failure().

Provided Methods§

Source

fn append(&mut self, other: &impl StatusTracker)

Appends the contents of another StatusTracker to this list of validation log items.

Source

fn filter_errors(&mut self) -> impl Iterator<Item = &LogItem>

Return the LogItems that have error conditions (err_val is populated).

Removes matching items from the list of log items.

Source

fn has_status(&self, val: &str) -> bool

Return true if the validation log contains a specific C2PA status code.

Source

fn has_error<E: Debug>(&self, err: E) -> bool

Return true if the validation log contains a specific error.

Source

fn push_ingredient_uri<S: Into<String>>(&mut self, _uri: S)

Keeps track of the current ingredient URI, if any.

The current URI may be added to any log items that are created.

Source

fn pop_ingredient_uri(&mut self) -> Option<String>

Removes the current ingredient URI, if any.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§