[−][src]Struct spirit::fragment::driver::CacheSimilar
A Driver
that caches both created Resource
s and their Seed
s to create as little as
possible.
It uses the Comparable
trait to decide if it needs to create the Resource
complete from
scratch, if it can reuse the old Seed
or if it can even keep the old instance. This is a
good driver for cases where the Seed
is some kind of unique resource and changing the
resource by creating a completely new instance while the old one existed wouldn't work. An
example of this is the bound ports on listening sockets ‒ while we might want to attach
different configuration to the same socket, opening a new socket with the same port would not
work. Therefore, the socket is somewhere within the Seed
and it is reused if the port
doesn't change.
Trait Implementations
impl<F: Debug + Fragment + ToOwned> Debug for CacheSimilar<F> where
F::Owned: Debug,
F::Seed: Debug,
[src]
F::Owned: Debug,
F::Seed: Debug,
impl<F: Fragment + ToOwned> Default for CacheSimilar<F>
[src]
impl<F> Driver<F> for CacheSimilar<F> where
F: Debug + Fragment + ToOwned + Comparable<<F as ToOwned>::Owned>,
[src]
F: Debug + Fragment + ToOwned + Comparable<<F as ToOwned>::Owned>,
type SubFragment = F
fn instructions<T, I>(
&mut self,
fragment: &F,
transform: &mut T,
name: &'static str
) -> Result<Vec<Instruction<T::OutputResource>>, Vec<AnyError>> where
T: Transformation<F::Resource, I, F>,
[src]
&mut self,
fragment: &F,
transform: &mut T,
name: &'static str
) -> Result<Vec<Instruction<T::OutputResource>>, Vec<AnyError>> where
T: Transformation<F::Resource, I, F>,
fn abort(&mut self, name: &'static str)
[src]
fn confirm(&mut self, name: &'static str)
[src]
fn maybe_cached(&self, fragment: &F, _name: &'static str) -> bool
[src]
Auto Trait Implementations
impl<F> RefUnwindSafe for CacheSimilar<F> where
<F as ToOwned>::Owned: RefUnwindSafe,
<F as Fragment>::Seed: RefUnwindSafe,
<F as ToOwned>::Owned: RefUnwindSafe,
<F as Fragment>::Seed: RefUnwindSafe,
impl<F> Send for CacheSimilar<F> where
<F as ToOwned>::Owned: Send,
<F as Fragment>::Seed: Send,
<F as ToOwned>::Owned: Send,
<F as Fragment>::Seed: Send,
impl<F> Sync for CacheSimilar<F> where
<F as ToOwned>::Owned: Sync,
<F as Fragment>::Seed: Sync,
<F as ToOwned>::Owned: Sync,
<F as Fragment>::Seed: Sync,
impl<F> Unpin for CacheSimilar<F> where
<F as ToOwned>::Owned: Unpin,
<F as Fragment>::Seed: Unpin,
<F as ToOwned>::Owned: Unpin,
<F as Fragment>::Seed: Unpin,
impl<F> UnwindSafe for CacheSimilar<F> where
<F as ToOwned>::Owned: UnwindSafe,
<F as Fragment>::Seed: UnwindSafe,
<F as ToOwned>::Owned: UnwindSafe,
<F as Fragment>::Seed: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoResult<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,