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§
Sourcefn with_uniqueness<P>(
self,
_policy: P,
) -> <P as UniquenessPolicy>::Decorator<T, Self>where
P: UniquenessPolicy,
fn with_uniqueness<P>(
self,
_policy: P,
) -> <P as UniquenessPolicy>::Decorator<T, Self>where
P: UniquenessPolicy,
Applies a UniquenessPolicy — Validate,
Resolve or CascadeResolve.
Sourcefn with_usages<P>(self, _policy: P) -> <P as UsagesPolicy>::Decorator<T, Self>where
P: UsagesPolicy,
fn with_usages<P>(self, _policy: P) -> <P as UsagesPolicy>::Decorator<T, Self>where
P: UsagesPolicy,
Applies a UsagesPolicy — Validate or
CascadeResolve.
Sourcefn with_usages_validation(self) -> UsagesValidator<T, Self>
fn with_usages_validation(self) -> UsagesValidator<T, Self>
Wraps in UsagesValidator.
Sourcefn with_cascade_usages_resolution(self) -> CascadeUsagesResolver<T, Self>
fn with_cascade_usages_resolution(self) -> CascadeUsagesResolver<T, Self>
Wraps in CascadeUsagesResolver.
Sourcefn with_inner_reference_existence_validation(
self,
) -> InnerReferenceExistenceValidator<T, Self>
fn with_inner_reference_existence_validation( self, ) -> InnerReferenceExistenceValidator<T, Self>
Wraps in InnerReferenceExistenceValidator.
Sourcefn with_non_existent_dependencies_creation(
self,
) -> NonExistentDependenciesCreator<T, Self>
fn with_non_existent_dependencies_creation( self, ) -> NonExistentDependenciesCreator<T, Self>
Wraps in NonExistentDependenciesCreator.
Sourcefn with_itself_constant_resolution(
self,
) -> ItselfConstantToSelfReferenceResolver<T, Self>
fn with_itself_constant_resolution( self, ) -> ItselfConstantToSelfReferenceResolver<T, Self>
Wraps in ItselfConstantToSelfReferenceResolver.
Sourcefn with_null_constant_resolution(
self,
) -> NullConstantToSelfReferenceResolver<T, Self>
fn with_null_constant_resolution( self, ) -> NullConstantToSelfReferenceResolver<T, Self>
Wraps in NullConstantToSelfReferenceResolver.
Sourcefn with_non_null_contents_deletion_resolution(
self,
) -> NonNullContentsLinkDeletionResolver<T, Self>
fn with_non_null_contents_deletion_resolution( self, ) -> NonNullContentsLinkDeletionResolver<T, Self>
Wraps in NonNullContentsLinkDeletionResolver.
Sourcefn with_logging<W>(self, writer: W) -> LoggingDecorator<T, Self, W>
fn with_logging<W>(self, writer: W) -> LoggingDecorator<T, Self, W>
Wraps in LoggingDecorator, logging every mutation to writer.
Sourcefn with_no_exceptions(self) -> NoExceptionsDecorator<T, Self>
fn with_no_exceptions(self) -> NoExceptionsDecorator<T, Self>
Wraps in NoExceptionsDecorator.
Sourcefn with_automatic_uniqueness_and_usages_resolution(
self,
) -> CascadeUniquenessAndUsagesResolver<T, NonNullContentsLinkDeletionResolver<T, CascadeUsagesResolver<T, Self>>>
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".