Skip to main content

DecoratorsExt

Trait DecoratorsExt 

Source
pub trait DecoratorsExt<T: LinkReference>: Doublets<T> + Sized {
Show 13 methods // Provided methods fn with_transactions<J: TransitionLog<T>>( self, journal: J, ) -> Result<TransactionsDecorator<T, Self, J>, Error<T>> { ... } fn with_uniqueness<P: UniquenessPolicy>( self, _policy: P, ) -> P::Decorator<T, Self> { ... } fn with_usages<P: UsagesPolicy>(self, _policy: P) -> P::Decorator<T, Self> { ... } 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: Write + Send + Sync>( self, writer: W, ) -> LoggingDecorator<T, Self, W> { ... } fn with_no_exceptions(self) -> NoExceptionsDecorator<T, Self> { ... } fn with_automatic_uniqueness_and_usages_resolution( self, ) -> AutomaticUniquenessAndUsagesResolution<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_transactions<J: TransitionLog<T>>( self, journal: J, ) -> Result<TransactionsDecorator<T, Self, J>, Error<T>>

Wraps the store in TransactionsDecorator and recovers its journal.

Source

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

Source

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

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: Write + Send + Sync>( self, writer: W, ) -> LoggingDecorator<T, Self, W>

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, ) -> AutomaticUniquenessAndUsagesResolution<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§