pub struct FormRegistry { /* private fields */ }Expand description
A lightweight, opt-in registry that connects app-owned Model<T> values to a FormState.
Notes:
- This is intentionally app-owned state (store it in your window state/driver), not a model.
- Validation remains value-driven: callers provide
validate(&T) -> Option<Arc<str>>. - The registry only reads values from the
ModelStore; it never owns field values.
Implementations§
Source§impl FormRegistry
impl FormRegistry
pub fn new() -> Self
pub fn options(self, options: FormRegistryOptions) -> Self
pub fn field_ids(&self) -> impl Iterator<Item = &FormFieldId>
pub fn register_into_form_state<H: ModelHost>( &self, host: &mut H, form_state: &Model<FormState>, )
pub fn register_field<T>( &mut self, id: impl Into<FormFieldId>, model: impl IntoFormValueModel<T>, initial: T, validate: impl Fn(&T) -> Option<Arc<str>> + 'static, )
pub fn handle_model_changes<H: ModelHost>( &self, host: &mut H, form_state: &Model<FormState>, changed: &[ModelId], )
pub fn submit<H: ModelHost>( &self, host: &mut H, form_state: &Model<FormState>, ) -> bool
Sourcepub fn submit_action_host(
&self,
host: &mut dyn UiActionHost,
form_state: &Model<FormState>,
) -> bool
pub fn submit_action_host( &self, host: &mut dyn UiActionHost, form_state: &Model<FormState>, ) -> bool
Object-safe form submission helper for action hooks.
fret_ui::action callbacks receive a &mut dyn UiActionHost (object-safe by design),
while submit() is generic over ModelHost. This helper bridges that gap without
exposing FormRegistry internals to call sites.
Trait Implementations§
Source§impl Clone for FormRegistry
impl Clone for FormRegistry
Source§fn clone(&self) -> FormRegistry
fn clone(&self) -> FormRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FormRegistry
impl Debug for FormRegistry
Source§impl Default for FormRegistry
impl Default for FormRegistry
Source§fn default() -> FormRegistry
fn default() -> FormRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FormRegistry
impl !RefUnwindSafe for FormRegistry
impl !Send for FormRegistry
impl !Sync for FormRegistry
impl Unpin for FormRegistry
impl UnsafeUnpin for FormRegistry
impl !UnwindSafe for FormRegistry
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
Mutably borrows from an owned value. Read more