pub trait Cache<Id: ?Sized> {
type Storage: AsRef<str>;
// Required methods
fn fetch(
&mut self,
id: &Id,
) -> Result<&Source<Self::Storage>, Box<dyn Debug + '_>>;
fn display<'a>(&self, id: &'a Id) -> Option<Box<dyn Display + 'a>>;
}
Expand description
A trait implemented by Source
caches.
Required Associated Types§
sourcetype Storage: AsRef<str>
type Storage: AsRef<str>
The type used to store the string data for this cache.
Alternative types other than String can be used, but at the moment, the storage must be
contiguous. A primary use case for this is to use a reference-counted string instead of
copying the whole contents into a Source
.