Trait ariadne::Cache

source ·
pub trait Cache<Id: ?Sized> {
    // Required methods
    fn fetch(&mut self, id: &Id) -> Result<&Source, Box<dyn Debug + '_>>;
    fn display<'a>(&self, id: &'a Id) -> Option<Box<dyn Display + 'a>>;
}
Expand description

A trait implemented by Source caches.

Required Methods§

source

fn fetch(&mut self, id: &Id) -> Result<&Source, Box<dyn Debug + '_>>

Fetch the Source identified by the given ID, if possible.

source

fn display<'a>(&self, id: &'a Id) -> Option<Box<dyn Display + 'a>>

Display the given ID. as a single inline value.

This function may make use of attributes from the Fmt trait.

Implementations on Foreign Types§

source§

impl<'b, C: Cache<Id>, Id: ?Sized> Cache<Id> for &'b mut C

source§

fn fetch(&mut self, id: &Id) -> Result<&Source, Box<dyn Debug + '_>>

source§

fn display<'a>(&self, id: &'a Id) -> Option<Box<dyn Display + 'a>>

source§

impl<C: Cache<Id>, Id: ?Sized> Cache<Id> for Box<C>

source§

fn fetch(&mut self, id: &Id) -> Result<&Source, Box<dyn Debug + '_>>

source§

fn display<'a>(&self, id: &'a Id) -> Option<Box<dyn Display + 'a>>

source§

impl<Id: Display + Eq> Cache<Id> for (Id, Source)

source§

fn fetch(&mut self, id: &Id) -> Result<&Source, Box<dyn Debug + '_>>

source§

fn display<'a>(&self, id: &'a Id) -> Option<Box<dyn Display + 'a>>

Implementors§

source§

impl Cache<()> for Source

source§

impl Cache<Path> for FileCache

source§

impl<Id: Display + Hash + PartialEq + Eq + Clone, F> Cache<Id> for FnCache<Id, F>where F: for<'a> FnMut(&'a Id) -> Result<String, Box<dyn Debug>>,