Skip to main content

MachineConstruction

Trait MachineConstruction 

Source
pub trait MachineConstruction<E, RuntimeT: Send>: Sized {
    // Required method
    fn query_cow<R: ClarifiedCerrMerging + 'static + Send>(
        self,
        closure: impl for<'a> FnOnce(Cow<'a, RuntimeT>) -> Machine<R> + 'static + Send,
    ) -> Machine<R>;

    // Provided methods
    fn query<R: ClarifiedCerrMerging + 'static + Send>(
        self,
        closure: impl FnOnce(RuntimeT) -> Machine<R> + 'static + Send,
    ) -> Machine<R>
       where RuntimeT: Clone { ... }
    fn query_ref<R: ClarifiedCerrMerging + 'static + Send>(
        self,
        closure: impl for<'a> FnOnce(&'a RuntimeT) -> Machine<R> + 'static + Send,
    ) -> Machine<R>
       where RuntimeT: Clone + CheapBorrowFromAny { ... }
}

Required Methods§

Source

fn query_cow<R: ClarifiedCerrMerging + 'static + Send>( self, closure: impl for<'a> FnOnce(Cow<'a, RuntimeT>) -> Machine<R> + 'static + Send, ) -> Machine<R>

Provided Methods§

Source

fn query<R: ClarifiedCerrMerging + 'static + Send>( self, closure: impl FnOnce(RuntimeT) -> Machine<R> + 'static + Send, ) -> Machine<R>
where RuntimeT: Clone,

Source

fn query_ref<R: ClarifiedCerrMerging + 'static + Send>( self, closure: impl for<'a> FnOnce(&'a RuntimeT) -> Machine<R> + 'static + Send, ) -> Machine<R>
where RuntimeT: Clone + CheapBorrowFromAny,

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<E, T, RuntimeT> MachineConstruction<E, Option<RuntimeT>> for Option<T>
where RuntimeT: Clone + Send, T: MachineConstruction<E, RuntimeT>,

WARNING: this always clones A solution, that involves work, could be to replace Cow in the closure signature with an associated type, but this would prevent inference. This is left open as most of the types in this project are cheap to clone

The problem is that a reference &RuntimeT can only be converted to an owned value of type Option<&RuntimeT> and not to &Option<RuntimeT> what would be needed for Cow. The other direction is possible using Option::as_ref.

This direction seems to be impossible so the only solution would be a new trait with new methods specifically for Option.

Source§

fn query_cow<R: ClarifiedCerrMerging + 'static + Send>( self, closure: impl for<'a> FnOnce(Cow<'a, Option<RuntimeT>>) -> Machine<R> + 'static + Send, ) -> Machine<R>

Implementors§

Source§

impl<E, RuntimeT> MachineConstruction<E, RuntimeT> for EntityId<E>
where EntityId<E>: PossibleRuntimeValue<RuntimeT>, RuntimeT: Clone + SpecializeFrom + Send, Entity: From<E>,

Source§

impl<RuntimeT> MachineConstruction<CompiledRegex, RuntimeT> for CompiledRegex

Source§

impl<RuntimeT> MachineConstruction<NetworkRequest, RuntimeT> for NetworkRequest

Source§

impl<RuntimeT> MachineConstruction<Selector, RuntimeT> for Selector
where Selector: PossibleRuntimeValue<RuntimeT>, RuntimeT: SpecializeFrom + Send,

Source§

impl<RuntimeT> MachineConstruction<ValueReference, RuntimeT> for &ValueReference
where ValueReference: PossibleRuntimeValue<RuntimeT>, RuntimeT: Clone + SpecializeFrom + 'static + Send, EntityId<Entity>: PossibleRuntimeValue<RuntimeT>,

Source§

impl<RuntimeT> MachineConstruction<ValueReference, RuntimeT> for ValueReference
where ValueReference: PossibleRuntimeValue<RuntimeT>, RuntimeT: Clone + SpecializeFrom + 'static + Send, EntityId<Entity>: PossibleRuntimeValue<RuntimeT>,