pub struct FlowLocal { /* private fields */ }Expand description
The runtime types that appear in bevy-brink’s own public signatures,
re-exported so consumers can name them without depending on brink-runtime:
FlowInstance, Program,
Choice, Step’s
return, RuntimeError’s error,
FallbackHandler for the “no bindings” advance path, the scoped
story-state types a host needs to build a policy and a per-step routing
view (see docs/scoped-flow-state-spec.md): WorldPolicy, Scope,
PolicyError, and ContextView (usually built via
flow_context_view instead of by hand) — and the per-entity durability
types produced/consumed by BrinkGlobals::save_state/load_state and
save_flow_state/load_flow_state (F6.3, see the globals module’s
“Save/load” docs): SaveState and LoadReport.
World is deliberately absent here — it collides with bevy::prelude::World
under a glob import, so it is re-exported under the alias BrinkWorld.
Per-flow override layer over the shared World.
F3.1: copy-on-write, frozen-base read-through chain. Each field is a
plain map/option holding this flow’s own overrides for units
ResolvedPolicy homes to Scope::Local (or, in Mode::Sandbox,
every unit — see Mode), plus an optional base: an immutable
[FrozenLocal] snapshot (see FlowLocal::freeze) of another
FlowLocal, captured at some earlier point. A read walks own
overrides → base (recursively) → [miss]; ContextView treats a miss
as “not in the local chain” and falls through to World, exactly as in
F2.2. Writes always land in the flow’s own top-layer overrides — never
in base, which is immutable by construction.
A fresh FlowLocal (via Default/FlowLocal::new) has empty
overrides, base: None, and mode: Mode::Normal, so it contributes no
reads and every access falls through to World — this is what keeps the
all-World policy (and every construction path that doesn’t call
fork) byte-identical to the F2.2 flat-storage behavior.
FlowLocal::fork (F3.2) is what actually populates a child’s base by
freezing its parent, and what bakes in a non-Normal mode.
ContextView (below) is what actually consults these maps; see its
docs for the read-through/copy-on-write-increment/mode semantics.
Implementations§
Source§impl FlowLocal
impl FlowLocal
Sourcepub fn new() -> FlowLocal
pub fn new() -> FlowLocal
Construct an empty flow-local layer — overrides nothing and has no
base, so every access routes through to World.
Sourcepub fn fork(&self, mode: Mode) -> FlowLocal
pub fn fork(&self, mode: Mode) -> FlowLocal
Fork a child FlowLocal from this one.
The child’s base is a frozen, point-in-time snapshot of self (via
freeze) — an O(1)-ish operation that clones this
flow’s own (small) override maps and Arc-bumps the rest of the
ancestry chain, never a full World copy. The child’s own override
layer starts empty, and it runs in mode for its lifetime (Mode is
baked in here, not mutable afterward).
Because the base is frozen, later mutations to self (the parent)
are not visible to the child — the child sees the parent exactly
as it was at fork time. Symmetrically, nothing the child does is ever
visible to self or World: writes land only in the child’s own top
layer (see Mode for how Sandbox additionally diverts
World-scoped writes there too). That makes discard trivial —
dropping the returned FlowLocal is the entire discard operation, no
unwinding required. Folding a child’s writes back into self instead
of discarding them is the deferred commit seam — see CommitError
and commit.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FlowLocal
impl RefUnwindSafe for FlowLocal
impl Send for FlowLocal
impl Sync for FlowLocal
impl Unpin for FlowLocal
impl UnsafeUnpin for FlowLocal
impl UnwindSafe for FlowLocal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FromTemplate for T
impl<T> FromTemplate for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
impl<T> Settings for T
Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.