Skip to main content

MapQuery

Trait MapQuery 

Source
pub trait MapQuery: CompileQuery<Self::Key, Self::Value> + PlanProperties {
    type Key: CellValue + Hash + Eq;
    type Value: CellValue;

    // Provided method
    fn materialize(self) -> CellMap<Self::Key, Self::Value, CellImmutable> { ... }
}
Expand description

Uncompiled reactive map operation chain.

Map queries are built by chaining pure operators on a source (CellMap or another MapQuery). They deliberately do not expose subscribe — call MapQuery::materialize to produce a subscribable CellMap.

§Invariants

  • materialize(self) consumes the plan and installs one subscription per interned physical root.
  • Plan-to-plan edges are statically typed; recognized regions fuse without an intermediate observable CellMap.
  • Publication is deterministic, ordered, and synchronously settled.
  • User closures follow the module-level purity and invocation contract.

§Sealing

The CompileQuery<K, V> supertrait is pub(crate), which seals MapQuery so external crates cannot define new query shapes. New plan shapes are added inside this crate.

§Not Clone

Map queries are deliberately not Clone. Cloning would silently duplicate join / projection work — each clone’s materialize() would install independent root subscriptions and run the entire op chain on every emission. To share work across consumers, materialize once into a CellMap (which IS Clone — the clone is an Arc bump referencing the same multicast cache) and then clone the cell map.

Required Associated Types§

Source

type Key: CellValue + Hash + Eq

Key produced by this query plan.

Source

type Value: CellValue

Value produced by this query plan.

Provided Methods§

Source

fn materialize(self) -> CellMap<Self::Key, Self::Value, CellImmutable>

Compile the query into a CellMap and install root subscriptions running the statically typed incremental runtime.

This is the only way to observe map-query output. Every subscription is on a materialized map, never on a plan. The returned map owns all root guards; dropping it tears the installation down. Publication caused by a source mutation is synchronously settled before that mutation returns.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<K, V, M> MapQuery for CellMap<K, V, M>
where K: CellValue + Hash + Eq, V: CellValue, M: Clone + Send + Sync + 'static,

Source§

type Key = K

Source§

type Value = V

Source§

impl<K, V> MapQuery for SharedMapQuery<K, V>
where K: CellValue + Hash + Eq, V: CellValue,

Source§

type Key = K

Source§

type Value = V

Source§

impl<L, R1, R2, LK, LV, RK1, RV1, JK1, MV, RK2, RV2, JK2, FL1, FR1, FM1, FL2, FR2> MapQuery for TwoLeftJoinPlan<L, R1, R2, LK, LV, RK1, RV1, JK1, MV, RK2, RV2, JK2, FL1, FR1, FM1, FL2, FR2>
where L: MapQuery<Key = LK, Value = LV>, R1: MapQuery<Key = RK1, Value = RV1>, R2: MapQuery<Key = RK2, Value = RV2>, LK: Hash + Eq + CellValue, LV: CellValue, RK1: Hash + Eq + CellValue, RV1: CellValue, JK1: Hash + Eq + CellValue, MV: CellValue, RK2: Hash + Eq + CellValue, RV2: CellValue, JK2: Hash + Eq + CellValue, FL1: Fn(&LK, &LV) -> JK1 + Send + Sync + 'static, FR1: RightJoinKey<RK1, RV1, JK1>, FM1: JoinProjection<LK, LV, RK1, RV1, MV>, FL2: Fn(&LK, &MV) -> JK2 + Send + Sync + 'static, FR2: RightJoinKey<RK2, RV2, JK2>,

Source§

type Key = LK

Source§

type Value = (MV, Vec<RV2>)

Source§

impl<L, R, LK, LV, RK, RV, JK, FL, FR> MapQuery for LeftJoinPlan<L, R, LK, LV, RK, RV, JK, FL, FR>
where L: MapQuery<Key = LK, Value = LV>, R: MapQuery<Key = RK, Value = RV>, LK: Hash + Eq + CellValue, LV: CellValue, RK: Hash + Eq + CellValue, RV: CellValue, JK: Hash + Eq + CellValue, FL: Fn(&LK, &LV) -> JK + Send + Sync + 'static, FR: RightJoinKey<RK, RV, JK>,

Source§

type Key = LK

Source§

type Value = (LV, Vec<RV>)

Source§

impl<L, R, LK, LV, RK, RV, JK, OV, FL, FR, F> MapQuery for JoinedValuesPlan<L, R, LK, LV, RK, RV, JK, OV, FL, FR, F>
where L: MapQuery<Key = LK, Value = LV>, R: MapQuery<Key = RK, Value = RV>, LK: Hash + Eq + CellValue, LV: CellValue, RK: Hash + Eq + CellValue, RV: CellValue, JK: Hash + Eq + CellValue, OV: CellValue, FL: Fn(&LK, &LV) -> JK + Send + Sync + 'static, FR: RightJoinKey<RK, RV, JK>, F: Fn(&LK, &LV, &[(RK, RV)]) -> OV + Send + Sync + 'static,

Source§

type Key = LK

Source§

type Value = OV

Source§

impl<Left, Stages, K, Input> MapQuery for JoinRegion<Left, Stages, K, Input>
where K: Hash + Eq + CellValue, Input: CellValue, Left: MapQuery<Key = K, Value = Input> + PlanProperties<OutputPartition = ByMapKey<K>>, Stages: StageList<K, Input> + SplitStages<K, Input, Here> + Send + Sync + 'static, Stages::Output: CellValue, Stages::Runtime: RuntimeStages<K, Input, Output = Stages::Output> + EmptyShardRuntime + HeadInputSnapshot<K, Input> + RuntimeStageCost + Send, Stages::Rights: InstallRights<Stages::Runtime, K, Input, Stages::Output>,

Source§

type Key = K

Source§

type Value = <Stages as StageList<K, Input>>::Output

Source§

impl<P, LK, MV, RK2, RV2, OV, F> MapQuery for TwoLeftJoinMappedPlan<P, LK, MV, RK2, RV2, OV, F>
where P: MapQuery<Key = LK, Value = (MV, Vec<RV2>)>, LK: Hash + Eq + CellValue, MV: CellValue, RK2: Hash + Eq + CellValue, RV2: CellValue, OV: CellValue, F: JoinProjection<LK, MV, RK2, RV2, OV>, Self: BuildQueryRuntime<LK, OV>,

Source§

type Key = LK

Source§

type Value = OV

Source§

impl<PK, K, V> MapQuery for NestedMap<PK, K, V>
where PK: CellValue + Hash + Eq, K: CellValue + Hash + Eq, V: CellValue,

Source§

type Key = K

Source§

type Value = V

Source§

impl<S, K, V, U, F> MapQuery for FilterMapValuesPlan<S, K, V, U, F>
where S: MapQuery<Key = K, Value = V>, K: Hash + Eq + CellValue, V: CellValue, U: CellValue, F: Fn(&K, &V) -> Option<U> + Send + Sync + 'static,

Source§

type Key = K

Source§

type Value = U

Source§

impl<S, K, V, U, F> MapQuery for MapValuesPlan<S, K, V, U, F>
where S: MapQuery<Key = K, Value = V>, K: Hash + Eq + CellValue, V: CellValue, U: CellValue, F: Fn(&K, &V) -> U + Send + Sync + 'static,

Source§

type Key = K

Source§

type Value = U