pub trait EditGuard: Sized {
type Data;
// Provided methods
fn configure(&mut self, edit: &mut Editor, cx: &mut ConfigCx<'_>) { ... }
fn update(
&mut self,
edit: &mut Editor,
cx: &mut ConfigCx<'_>,
data: &Self::Data,
) { ... }
fn activate(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
) -> IsUsed { ... }
fn focus_gained(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
) { ... }
fn focus_lost(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
) { ... }
fn edit(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
) { ... }
}Expand description
Required Associated Types§
Provided Methods§
Sourcefn configure(&mut self, edit: &mut Editor, cx: &mut ConfigCx<'_>)
fn configure(&mut self, edit: &mut Editor, cx: &mut ConfigCx<'_>)
Configure guard
This function is called when the attached widget is configured.
Sourcefn update(
&mut self,
edit: &mut Editor,
cx: &mut ConfigCx<'_>,
data: &Self::Data,
)
fn update( &mut self, edit: &mut Editor, cx: &mut ConfigCx<'_>, data: &Self::Data, )
Update guard
This function is called when input data is updated and the editor does not have input focus.
This method may also be called on loss of input focus (see
Self::focus_lost).
Sourcefn activate(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
) -> IsUsed
fn activate( &mut self, edit: &mut Editor, cx: &mut EventCx<'_>, data: &Self::Data, ) -> IsUsed
Activation guard
This function is called when the widget is “activated”, for example by
the Enter/Return key for single-line edit boxes. Its result is returned
from handle_event.
The default implementation:
- If the field is editable, calls
Self::focus_lostand returns returnsUsed. - If the field is not editable, returns
Unused.
Sourcefn focus_gained(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
)
fn focus_gained( &mut self, edit: &mut Editor, cx: &mut EventCx<'_>, data: &Self::Data, )
Focus-gained guard
This function is called when the widget gains keyboard or IME focus.
Sourcefn focus_lost(
&mut self,
edit: &mut Editor,
cx: &mut EventCx<'_>,
data: &Self::Data,
)
fn focus_lost( &mut self, edit: &mut Editor, cx: &mut EventCx<'_>, data: &Self::Data, )
Focus-lost guard
This function is called after the widget has lost both keyboard and IME focus.
The default implementation calls Self::update since updates are
inhibited while the editor has input focus.
Sourcefn edit(&mut self, edit: &mut Editor, cx: &mut EventCx<'_>, data: &Self::Data)
fn edit(&mut self, edit: &mut Editor, cx: &mut EventCx<'_>, data: &Self::Data)
Edit guard
This function is called after the text is updated (including by keyboard
input, an undo action or by a message like
kas::messages::SetValueText). The exceptions are setter methods like
clear and set_string.
The guard may call Editor::set_error here.
The error state is cleared immediately before calling this method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.