pub trait View<B>: Any {
// Required methods
fn apply(&mut self, event: &Event<B>);
fn cursor(&self) -> u64;
fn as_any(&self) -> &dyn Any;
}Expand description
A live view the DB drives type-erased, as dyn View<B>.
Deliberately object-safe — no associated types, no Self-returning
methods — which is exactly why it is not : Projection. Projection
has type State and state(&self) -> &Self::State, and an associated
type makes dyn Projection impossible. A View carries only what the
registry needs to drive it (apply/cursor) and downcast it
(as_any); the query methods live on the concrete type, reached after
downcast via crate::Salamander::view.
IndexedView implements both View (so the registry can store it
as dyn View) and Projection (so replay_into/view_at still build
it on demand for time-travel). A concrete type implementing two traits
is fine; only the stored form is erased.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".