pub struct Factory { /* private fields */ }Expand description
A factory for generating and caching test artifacts.
Factory is cheap to clone; clones share the same cache.
Implementations§
Source§impl Factory
impl Factory
Sourcepub fn deterministic(master: Seed) -> Self
pub fn deterministic(master: Seed) -> Self
Create a factory in deterministic mode from a master seed.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the artifact cache.
Sourcepub fn get_or_init<T, F>(
&self,
domain: ArtifactDomain,
label: &str,
spec_bytes: &[u8],
variant: &str,
init: F,
) -> Arc<T>
pub fn get_or_init<T, F>( &self, domain: ArtifactDomain, label: &str, spec_bytes: &[u8], variant: &str, init: F, ) -> Arc<T>
Return a cached value by (domain, label, spec, variant) or generate one.
The initializer receives the derived seed for this artifact identity. Callers that need an RNG should instantiate it privately from that seed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Factory
impl !RefUnwindSafe for Factory
impl Send for Factory
impl Sync for Factory
impl Unpin for Factory
impl UnsafeUnpin for Factory
impl !UnwindSafe for Factory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more