Struct FormField

Source
pub struct FormField<'a, 'f, Errors: EguiValidationReport> { /* private fields */ }
Expand description

A form field that can be validated. Will color the field red (using the color from egui::style::Visuals::error_fg_color) if there is an error. Will show the error message below the field if the field is blurred and there is an error.

Implementations§

Source§

impl<'a, 'f, Errors: EguiValidationReport> FormField<'a, 'f, Errors>

Source

pub fn new<'c, I: IntoFieldPath<Errors::FieldPath<'c>>>( form: &'f mut Form<Errors>, into_field_path: I, ) -> Self

Create a new FormField. Pass a Form and a reference to the field you want to validate. If you use crate::garde, just pass the field name / path as a string. If you use crate::validator, pass a field reference using the [crate::field_path] macro.

Source

pub fn label(self, label: impl Into<Cow<'a, str>>) -> Self

Optionally set a label for the field.

Source

pub fn ui(self, ui: &mut Ui, content: impl Widget) -> Response

Render the field.

Auto Trait Implementations§

§

impl<'a, 'f, Errors> Freeze for FormField<'a, 'f, Errors>

§

impl<'a, 'f, Errors> RefUnwindSafe for FormField<'a, 'f, Errors>
where Errors: RefUnwindSafe,

§

impl<'a, 'f, Errors> Send for FormField<'a, 'f, Errors>
where Errors: Send,

§

impl<'a, 'f, Errors> Sync for FormField<'a, 'f, Errors>
where Errors: Sync,

§

impl<'a, 'f, Errors> Unpin for FormField<'a, 'f, Errors>

§

impl<'a, 'f, Errors> !UnwindSafe for FormField<'a, 'f, Errors>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,