Skip to main content

Resolve

Trait Resolve 

Source
pub trait Resolve {
    // Required method
    fn reference(&mut self, r: &Ref, path: &Path) -> Result<RefKey, Unresolved>;

    // Provided method
    fn expand(
        &mut self,
        _r: &Ref,
        _path: &Path,
    ) -> Result<Option<Value>, Unresolved> { ... }
}
Expand description

What a tool makes of the references it reads: a build checks each one against what there is (and may rewrite its id), an editor shows them.

Required Methods§

Source

fn reference(&mut self, r: &Ref, path: &Path) -> Result<RefKey, Unresolved>

A reference at path: the id to keep, or why it’s wrong.

§Errors

Unresolved when the reference names nothing there is, or names it in a way the tool refuses.

Provided Methods§

Source

fn expand( &mut self, _r: &Ref, _path: &Path, ) -> Result<Option<Value>, Unresolved>

A reference at path the tool replaces by a value — a word of a dictionary, a localized text: Some(value) is read in its place, None keeps it a reference. Asked only where a field says it takes a value or a reference (with::Expand); a reference met anywhere else goes through Resolve::reference.

§Errors

Unresolved when the reference names nothing there is, or names it in a way the tool refuses.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§