pub trait Cache<Id: ?Sized> {
type Storage: AsRef<str>;
// Required methods
fn fetch(&mut self, id: &Id) -> Result<&Source<Self::Storage>, impl Debug>;
fn display<'a>(&self, id: &'a Id) -> Option<impl 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
.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.