[−][src]Struct daab::ArtifactCache
Central structure to prevent dependency duplication on building.
Notice the debugging version (activating the diagnostics
feature) of this
struct contains a debugging Doctor
, which
allows run-time inspection of various events. Therefore, ArtifactCache
is generic to some Doctor
.
Thus, the new()
function returns actually a ArtifactCache<NoopDoctor>
and new_with_doctor()
returns some ArtifactCache<T>
those
can be store in variables.
However, since most of the code does not care about the concrete
Doctor
the default generic is dyn Doctor
.
To ease conversion between them, all creatable ArtifactCache
s
(i.e. not ArtifactCache<dyn Doctor>
) implement DerefMut
to
ArtifactCache<dyn Doctor>
which has all the methods implemented.
Methods
impl ArtifactCache<DefDoctor>
[src]
impl<T: Doctor + 'static> ArtifactCache<T>
[src]
pub fn new_with_doctor(doctor: T) -> Self
[src]
Creates new empty cache with given doctor for drop-in inspection.
Notice: This function is only available if the diagnostics
feature has been activated.
pub fn get_doctor(&mut self) -> &mut T
[src]
Returns a reference of the inner doctor.
Notice: This function is only available if the diagnostics
feature has been activated.
pub fn into_doctor(self) -> T
[src]
Consumes the ArtifactCache
and returns the inner doctor.
Notice: This function is only available if the diagnostics
feature has been activated.
impl ArtifactCache
[src]
pub fn get<B: Builder + 'static>(
&mut self,
promise: &ArtifactPromise<B>
) -> Rc<B::Artifact> where
<B as Builder>::Artifact: 'static,
[src]
&mut self,
promise: &ArtifactPromise<B>
) -> Rc<B::Artifact> where
<B as Builder>::Artifact: 'static,
Gets the artifact of the given builder.
This method looks up whether the artifact for the given builder is still present in the cache, or it will use the builder to build and store the artifact.
Notice the given promise will be stored kept to prevent it from
deallocating. clear()
or invalidate()
must be called in order to
free those Rc
s if required.
pub fn clear(&mut self)
[src]
Clears the entire cache including all kept builder and artifact Rc
s.
pub fn invalidate<B: Builder + 'static>(&mut self, promise: &ArtifactPromise<B>)
[src]
Clears cached artifact of the given builder and all depending artifacts.
Depending artifacts are all artifacts which used the former during
its building. The dependencies are automatically tracked using the
ArtifactResolver
struct.
Methods from Deref<Target = ArtifactCache>
pub fn get_doctor(&mut self) -> &mut T
[src]
Returns a reference of the inner doctor.
Notice: This function is only available if the diagnostics
feature has been activated.
pub fn get<B: Builder + 'static>(
&mut self,
promise: &ArtifactPromise<B>
) -> Rc<B::Artifact> where
<B as Builder>::Artifact: 'static,
[src]
&mut self,
promise: &ArtifactPromise<B>
) -> Rc<B::Artifact> where
<B as Builder>::Artifact: 'static,
Gets the artifact of the given builder.
This method looks up whether the artifact for the given builder is still present in the cache, or it will use the builder to build and store the artifact.
Notice the given promise will be stored kept to prevent it from
deallocating. clear()
or invalidate()
must be called in order to
free those Rc
s if required.
pub fn clear(&mut self)
[src]
Clears the entire cache including all kept builder and artifact Rc
s.
pub fn invalidate<B: Builder + 'static>(&mut self, promise: &ArtifactPromise<B>)
[src]
Clears cached artifact of the given builder and all depending artifacts.
Depending artifacts are all artifacts which used the former during
its building. The dependencies are automatically tracked using the
ArtifactResolver
struct.
Trait Implementations
impl Default for ArtifactCache<DefDoctor>
[src]
impl<T: Doctor + 'static> Deref for ArtifactCache<T>
[src]
type Target = ArtifactCache
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<T: Doctor + 'static> DerefMut for ArtifactCache<T>
[src]
Auto Trait Implementations
impl<T = dyn Doctor + 'static> !RefUnwindSafe for ArtifactCache<T>
impl<T = dyn Doctor + 'static> !Send for ArtifactCache<T>
impl<T = dyn Doctor + 'static> !Sync for ArtifactCache<T>
impl<T: ?Sized> Unpin for ArtifactCache<T> where
T: Unpin,
T: Unpin,
impl<T = dyn Doctor + 'static> !UnwindSafe for ArtifactCache<T>
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, 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>,