pub struct WorldPolicy {
pub default: Scope,
pub overrides: BTreeMap<String, Scope>,
pub turn_index: Scope,
pub rng: Scope,
}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.
Host-facing, name-based declaration of the world/local split.
Resolved once (via ResolvedPolicy::resolve) against a linked
Program’s symbol table into a fast id/slot-based ResolvedPolicy.
Unlisted variables and knots/stitches fall back to default.
The all-World default (via WorldPolicy::default) is the
degenerate, oracle-safety-anchoring policy: every unit homed to
World, no overrides — identical to today’s single-flow behavior.
Name precedence: a name in overrides is tried as a global variable
first, then as a knot/stitch path (see ResolvedPolicy::resolve). If a
name is (unusually) both a declared global VAR and a resolvable knot/
stitch path, the override resolves against the variable, never the
knot — the knot path is not consulted once a variable of the same name
is found.
Knot/stitch overrides are subtree-inclusive (F6.1c —
docs/scoped-flow-state-spec.md’s F6 AMENDMENT, ruling 3): a knot
override covers the knot’s own visit/turn count, every stitch nested
directly under it, and every interior container (weave/sequence/choice
container) nested anywhere under the knot or one of its stitches — not
just the knot’s own DefinitionId. This matters because ink’s
sequence/cycle/stopping machinery ({ Halt! | Back again? }) keys its
counter off the sequence’s own interior container id, not the
enclosing knot’s id; without subtree inclusion, a knot marked Local
would leave those interior counters silently World-scoped.
Most-specific override wins. If both a knot and one of its stitches
appear in overrides (e.g. knot a is Local, stitch a.b is
World), every interior container nested under a.b resolves World;
the rest of a’s subtree (the knot’s own id, its other stitches, and
any interior container not under a.b) resolves Local. A stitch’s
override always wins over its enclosing knot’s for the stitch’s own
subtree, regardless of which name appears earlier in overrides (see
ResolvedPolicy::resolve for how this is implemented).
Fields§
§default: ScopeScope for any variable or knot/stitch not named in overrides.
overrides: BTreeMap<String, Scope>Per-name exceptions to default, for global variables (matched
against Program::global_index’s name grammar) and knot/stitch
paths (matched against Program::find_path_target’s path
grammar). A name may appear in only one of the two — the resolver
tries variables first, then knot paths. Knot/stitch overrides are
subtree-inclusive with most-specific-wins precedence — see the type
docs above.
turn_index: ScopeScope of the turn index (a single scalar field).
rng: ScopeScope of the RNG stream (rng_seed + previous_random, a single
scalar stream). See the spec’s determinism caveat: a World-scoped
RNG interleaves draws from every flow sharing the world by
execution order.
Trait Implementations§
Source§impl Clone for WorldPolicy
impl Clone for WorldPolicy
Source§fn clone(&self) -> WorldPolicy
fn clone(&self) -> WorldPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WorldPolicy
impl Debug for WorldPolicy
Source§impl Default for WorldPolicy
impl Default for WorldPolicy
Source§fn default() -> WorldPolicy
fn default() -> WorldPolicy
Auto Trait Implementations§
impl Freeze for WorldPolicy
impl RefUnwindSafe for WorldPolicy
impl Send for WorldPolicy
impl Sync for WorldPolicy
impl Unpin for WorldPolicy
impl UnsafeUnpin for WorldPolicy
impl UnwindSafe for WorldPolicy
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.