pub struct Core {
pub tree: Tree,
pub caches: SharedState,
pub active_subscriptions: HashMap<String, Vec<SubscriptionEntry>>,
pub default_event_rate: Option<u32>,
pub default_text_size: Option<f32>,
pub default_font: Option<Font>,
pub cached_theme: Option<Theme>,
pub cached_theme_chrome: ThemeChrome,
pub effect_stubs: HashMap<String, Value>,
pub validate_props: Option<bool>,
/* private fields */
}Expand description
Pure state core, decoupled from the iced runtime.
Owns the retained UI tree, widget caches, active subscriptions, and
global rendering defaults. The host calls apply with
each incoming message and executes the returned CoreEffects.
Fields§
§tree: TreeThe retained UI tree (snapshots replace it, patches update it).
caches: SharedStateCaches for stateful widgets (text_editor content, markdown items, etc.).
active_subscriptions: HashMap<String, Vec<SubscriptionEntry>>Active event subscriptions: kind -> list of entries. Each kind can have multiple entries with different tags and optional window scoping.
default_event_rate: Option<u32>Global default event rate from Settings (events per second). None = no limit (full speed).
default_text_size: Option<f32>Global default text size from Settings.
default_font: Option<Font>Global default font from Settings.
cached_theme: Option<Theme>Cached resolved theme from the root node’s theme prop.
Only re-resolved when the raw JSON value changes.
cached_theme_chrome: ThemeChrome§effect_stubs: HashMap<String, Value>Registered effect stubs: kind -> response value. When an effect request matches a stub, the renderer returns the stubbed response immediately without executing the real effect. Used for testing and scripting.
validate_props: Option<bool>Per-session prop-validation override.
Some(true) enables validation for this session.
None falls back to the process-wide
is_validate_props_enabled
check (which itself defaults to cfg(debug_assertions) when
no global value has been set). validate_props: false in
Settings does not disable validation; it leaves the fallback in
control so hosts cannot turn off debug/default validation for a
session.
Implementations§
Source§impl Core
impl Core
pub fn new() -> Self
Sourcepub fn is_validate_props_enabled(&self) -> bool
pub fn is_validate_props_enabled(&self) -> bool
Resolve whether prop validation should run for this session.
A per-session true forces validation on. Otherwise the
process-wide flag decides.
Sourcepub fn has_subscription(&self, kind: &str) -> bool
pub fn has_subscription(&self, kind: &str) -> bool
Check whether at least one entry is registered for the given kind.
Sourcepub fn matching_entries(
&self,
kind: &str,
window_id: Option<&str>,
) -> Vec<&SubscriptionEntry>
pub fn matching_entries( &self, kind: &str, window_id: Option<&str>, ) -> Vec<&SubscriptionEntry>
Return all entries matching a kind, filtered by window_id. An entry matches if its window_id is None (global) or equals the event’s window_id.
Sourcepub fn matching_entries_with_catchall(
&self,
kind: &str,
catchall_kind: &str,
window_id: Option<&str>,
) -> Vec<&SubscriptionEntry>
pub fn matching_entries_with_catchall( &self, kind: &str, catchall_kind: &str, window_id: Option<&str>, ) -> Vec<&SubscriptionEntry>
Return all entries matching a specific kind plus the catch-all SUB_EVENT kind, filtered by window_id. Useful for event emission where both specific and catch-all subscriptions should fire.
Sourcepub fn subscription_rates(&self) -> impl Iterator<Item = (&str, u32)>
pub fn subscription_rates(&self) -> impl Iterator<Item = (&str, u32)>
Collect all max_rate values from subscription entries, keyed by tag. Returns (tag, max_rate) pairs for entries that have a max_rate set. The tag includes window scope when present, so rate limiting is isolated per subscription entry.
Collect all tags that have a max_rate set.
Sourcepub fn tree_hash(&self) -> String
pub fn tree_hash(&self) -> String
Compute the canonical SHA-256 hash of the current tree. Returns the hex-encoded hash string, or an empty string if no tree.
Sourcepub fn apply(&mut self, message: IncomingMessage) -> Vec<CoreEffect>
pub fn apply(&mut self, message: IncomingMessage) -> Vec<CoreEffect>
Process an incoming message, mutate state, return effects.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Core
impl RefUnwindSafe for Core
impl Send for Core
impl Sync for Core
impl Unpin for Core
impl UnsafeUnpin for Core
impl UnwindSafe for Core
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for T
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.