Skip to main content

DecoratorsExt

Trait DecoratorsExt 

Source
pub trait DecoratorsExt<T>: Sized + Doublets<T>
where T: LinkReference,
{ // Provided methods fn with_uniqueness<P>( self, _policy: P, ) -> <P as UniquenessPolicy>::Decorator<T, Self> where P: UniquenessPolicy { ... } fn with_usages<P>( self, _policy: P, ) -> <P as UsagesPolicy>::Decorator<T, Self> where P: UsagesPolicy { ... } fn with_usages_validation(self) -> UsagesValidator<T, Self> { ... } fn with_cascade_usages_resolution(self) -> CascadeUsagesResolver<T, Self> { ... } fn with_inner_reference_existence_validation( self, ) -> InnerReferenceExistenceValidator<T, Self> { ... } fn with_non_existent_dependencies_creation( self, ) -> NonExistentDependenciesCreator<T, Self> { ... } fn with_itself_constant_resolution( self, ) -> ItselfConstantToSelfReferenceResolver<T, Self> { ... } fn with_null_constant_resolution( self, ) -> NullConstantToSelfReferenceResolver<T, Self> { ... } fn with_non_null_contents_deletion_resolution( self, ) -> NonNullContentsLinkDeletionResolver<T, Self> { ... } fn with_logging<W>(self, writer: W) -> LoggingDecorator<T, Self, W> where W: Write + Send + Sync { ... } fn with_no_exceptions(self) -> NoExceptionsDecorator<T, Self> { ... } fn with_automatic_uniqueness_and_usages_resolution( self, ) -> CascadeUniquenessAndUsagesResolver<T, NonNullContentsLinkDeletionResolver<T, CascadeUsagesResolver<T, Self>>> { ... } }
Expand description

Composes decorators around a store.

Every method takes the store by value and returns the concrete composed type, so a stack is built at compile time and every layer is a candidate for inlining:

use doublets::{decorators::{DecoratorsExt, Resolve}, mem, unit, Doublets};

let mut store = unit::Store::<usize, _>::new(mem::Global::new())?
    .with_uniqueness(Resolve)
    .with_usages_validation();

let a = store.create_point()?;
let b = store.create_point()?;
// The second `create_link` reuses the first one instead of storing a duplicate.
assert_eq!(store.create_link(a, b)?, store.create_link(a, b)?);

Provided Methods§

Source

fn with_uniqueness<P>( self, _policy: P, ) -> <P as UniquenessPolicy>::Decorator<T, Self>

Source

fn with_usages<P>(self, _policy: P) -> <P as UsagesPolicy>::Decorator<T, Self>
where P: UsagesPolicy,

Source

fn with_usages_validation(self) -> UsagesValidator<T, Self>

Wraps in UsagesValidator.

Source

fn with_cascade_usages_resolution(self) -> CascadeUsagesResolver<T, Self>

Source

fn with_inner_reference_existence_validation( self, ) -> InnerReferenceExistenceValidator<T, Self>

Source

fn with_non_existent_dependencies_creation( self, ) -> NonExistentDependenciesCreator<T, Self>

Source

fn with_itself_constant_resolution( self, ) -> ItselfConstantToSelfReferenceResolver<T, Self>

Source

fn with_null_constant_resolution( self, ) -> NullConstantToSelfReferenceResolver<T, Self>

Source

fn with_non_null_contents_deletion_resolution( self, ) -> NonNullContentsLinkDeletionResolver<T, Self>

Source

fn with_logging<W>(self, writer: W) -> LoggingDecorator<T, Self, W>
where W: Write + Send + Sync,

Wraps in LoggingDecorator, logging every mutation to writer.

Source

fn with_no_exceptions(self) -> NoExceptionsDecorator<T, Self>

Source

fn with_automatic_uniqueness_and_usages_resolution( self, ) -> CascadeUniquenessAndUsagesResolver<T, NonNullContentsLinkDeletionResolver<T, CascadeUsagesResolver<T, Self>>>

Builds the same stack as C# ILinksExtensions.DecorateWithAutomaticUniquenessAndUsagesResolution: CascadeUsagesResolver innermost, then NonNullContentsLinkDeletionResolver, then CascadeUniquenessAndUsagesResolver outermost.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, L> DecoratorsExt<T> for L
where T: LinkReference, L: Doublets<T>,