Skip to main content

Engine

Trait Engine 

Source
pub trait Engine:
    Debug
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn fold(&self, layers: &[Layer<'_>]) -> Result<Folded, Error>;
}
Expand description

A fold, and where each leaf came from.

Implement this to resolve with something else entirely — a backend this crate does not ship, or a rule of your own. Two things are asked of an implementation, and the rest is its business:

  • Precedence is the argument’s order. layers[0] is the lowest.
  • A tag is reported only for a leaf that layer actually supplied.

§Errors

A fold can fail — a backend may refuse a key shape of its own — and the error reaches the caller as an ordinary load failure. It must not carry a configuration value: an engine that puts one in a message breaks the contract every other part of this crate keeps.

Required Methods§

Source

fn name(&self) -> &str

What to call this engine in a diagnostic.

Source

fn fold(&self, layers: &[Layer<'_>]) -> Result<Folded, Error>

Folds layers, lowest precedence first.

§Errors

If the backend refuses the shape it was handed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§