Skip to main content

Resolver

Trait Resolver 

Source
pub trait Resolver {
    // Required methods
    fn reference(
        &mut self,
        kind: RefKind,
        id: &str,
        path: &str,
    ) -> Result<String, String>;
    fn text(&mut self, text: &str, path: &str) -> Option<String>;

    // Provided method
    fn text_of(&mut self, _text: &str) -> Option<String> { ... }
}
Expand description

What a tool does with a book’s references and texts.

Required Methods§

Source

fn reference( &mut self, kind: RefKind, id: &str, path: &str, ) -> Result<String, String>

A reference of kind to id at path (entries[2].pages[0].item): the id the game uses, or why it’s wrong.

Source

fn text(&mut self, text: &str, path: &str) -> Option<String>

A text: what to put instead (a translation key for @Book.title, a name for @item:…), None to keep it. Its links are checked through Resolver::reference already.

Provided Methods§

Source

fn text_of(&mut self, _text: &str) -> Option<String>

The text a whole-text reference stands for (@Book.title → its words), to check the links in it; None if unknown.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§