pub struct EntityBounds {
pub publishers: usize,
pub service_servers: usize,
pub service_clients: usize,
pub action_clients: usize,
pub action_servers: usize,
pub timers: usize,
}Expand description
phase-391 W5-endgame step 2c (issue 0857) — a component class’s declared upper bounds, PER ENTITY KIND, for sizing its cell registries at compile time.
The runtime’s per-class cell storage is static, so its registries pay
their CAPACITY whether or not entities fill it — and one publisher slot
costs ~1.35 KiB (the loan arena rides inside). The default is the
NROS_RUNTIME_MAX_CELL_ENTITIES knob per kind, which always works;
a class that declares its real bounds pays exactly what it uses.
Declaring FEWER than register() creates is a loud registration error
(registry full), never a silent drop.
Public and non-generic on purpose (the ExecutorSizing rule): the const
generics this feeds stay behind the nros::node! macro emission, so no
other language ever sees them.
Fields§
§publishers: usizePublishers this class creates (each slot ~1.35 KiB — the big one).
service_servers: usizeService servers (sizes the trampoline-context slab, not a registry).
service_clients: usizeService clients.
action_clients: usizeAction clients.
action_servers: usizeAction servers.
timers: usizeIssue 2075 — timers the component can START, RESET or CANCEL by id
(CallbackCtx::reset_timer / TickCtx::cancel_timer). Sizes a
small id-to-handle table (16 B a row), not the timers themselves: a
timer past this bound still registers and fires, it just cannot be
controlled, and naming it answers NodeDeclError::UnknownTimer.
Implementations§
Source§impl EntityBounds
impl EntityBounds
Sourcepub const fn knob_caps() -> Self
pub const fn knob_caps() -> Self
The knob-capped default (NROS_RUNTIME_MAX_CELL_ENTITIES per kind).
Sourcepub const fn exact(
publishers: usize,
service_servers: usize,
service_clients: usize,
action_clients: usize,
action_servers: usize,
) -> Self
pub const fn exact( publishers: usize, service_servers: usize, service_clients: usize, action_clients: usize, action_servers: usize, ) -> Self
Exact bounds, spelled positionally:
(publishers, service_servers, service_clients, action_clients, action_servers).
Controllable timers default to 0 here (issue 2075), so a class that
states exact bounds pays nothing for the timer table it did not ask
for. Its timers still run; add with_timers to
reset or cancel them by id.
Sourcepub const fn with_timers(self, timers: usize) -> Self
pub const fn with_timers(self, timers: usize) -> Self
Issue 2075 — these bounds with timers controllable timers: how many
declared timers the component can start, reset or cancel by id.
const ENTITY_BOUNDS: nros::EntityBounds =
nros::EntityBounds::exact(1, 0, 0, 0, 0).with_timers(2);Trait Implementations§
Source§impl Clone for EntityBounds
impl Clone for EntityBounds
Source§fn clone(&self) -> EntityBounds
fn clone(&self) -> EntityBounds
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more