[][src]Struct spirit::fragment::driver::CacheSimilar

pub struct CacheSimilar<F: Fragment + ToOwned> { /* fields omitted */ }

A Driver that caches both created Resources and their Seeds 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]

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]

type SubFragment = F

The smaller Fragment the driver cuts F into. Read more

Auto Trait Implementations

impl<F> RefUnwindSafe for CacheSimilar<F> where
    <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

impl<F> Sync for CacheSimilar<F> where
    <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

impl<F> UnwindSafe for CacheSimilar<F> where
    <F as ToOwned>::Owned: UnwindSafe,
    <F as Fragment>::Seed: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoResult<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.