Skip to main content

FormCpt

Struct FormCpt 

Source
pub struct FormCpt<FID, CID, CA, CS, CM>
where FID: EzCptIds, CID: EzCptIds, CA: EzArgs, CS: EzState, CM: EzMsg,
{ /* private fields */ }
Expand description

A component responsible for rendering a form.

Implementations§

Source§

impl<FID, CID, CA, CS, CM> FormCpt<FID, CID, CA, CS, CM>
where FID: EzCptIds, CID: EzCptIds, CA: EzArgs, CS: EzState, CM: EzMsg,

Source

pub fn new(form: Form<FID>) -> Self

Create a new FormCpt component with a given form.

Source

pub fn collect(&self) -> FormResult<FID>

Collect this form result as a FormResult.

Source

pub fn capture_validation(&mut self) -> bool

Pass the validation event of this form to all its inputs so they can act on it and return wether or not validation has been handled internally.

Trait Implementations§

Source§

impl<FID, CID, CA, CS, CM> Component<CID, CA, CS, CM> for FormCpt<FID, CID, CA, CS, CM>
where FID: EzCptIds, CID: EzCptIds, CA: EzArgs, CS: EzState, CM: EzMsg,

Source§

fn on_event( &mut self, event: EzEvent<CID, CM>, state: &mut State<CS>, ) -> Vec<EzEvent<CID, CM>>

Method to implement to handle events. The component will receive any event if it is focused; but only events it is subscribed to otherwise.
Source§

fn focusable(&self) -> bool

Whether the component is focusable or not.
Source§

fn legend(&self) -> Option<Legend>

Get the component’s hotkeys legend.
Source§

fn capture_focus(&mut self, forward: bool) -> bool

Returns true if the focus is handled internally. Let’s say this component has two inner focusable area: Read more
Source§

fn init(&mut self, state: &mut State<CS>) -> Vec<EzEvent<CID, CM>>

Method called on first tick only.
Source§

fn tick(&mut self, state: &mut State<CS>) -> Vec<EzEvent<CID, CM>>

Method called on every tick. You should implement it only if you need to save a reference to the state or if your business logic needs to execute some code on a regular basis.
Source§

impl<FID, CID, CA, CS, CM> Debug for FormCpt<FID, CID, CA, CS, CM>
where FID: EzCptIds + Debug, CID: EzCptIds + Debug, CA: EzArgs + Debug, CS: EzState + Debug, CM: EzMsg + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<FID, CID, CA, CS, CM> MockComponent for FormCpt<FID, CID, CA, CS, CM>
where FID: EzCptIds, CID: EzCptIds, CA: EzArgs, CS: EzState, CM: EzMsg,

Source§

fn draw(&mut self, area: Rect, buf: &mut Buffer, theme: &Theme)

Draw the component in the given area of the given buffer.
Source§

impl<FID, CID, CA, CS, CM> MockProps for FormCpt<FID, CID, CA, CS, CM>
where FID: EzCptIds, CID: EzCptIds, CA: EzArgs, CS: EzState, CM: EzMsg,

Source§

fn props(&self) -> Option<&Props>

Get a reference to the component’s attribute
Source§

fn props_mut(&mut self) -> Option<&mut Props>

Get a mutable reference to the component’s attribute

Auto Trait Implementations§

§

impl<FID, CID, CA, CS, CM> !RefUnwindSafe for FormCpt<FID, CID, CA, CS, CM>

§

impl<FID, CID, CA, CS, CM> !Send for FormCpt<FID, CID, CA, CS, CM>

§

impl<FID, CID, CA, CS, CM> !Sync for FormCpt<FID, CID, CA, CS, CM>

§

impl<FID, CID, CA, CS, CM> !UnwindSafe for FormCpt<FID, CID, CA, CS, CM>

§

impl<FID, CID, CA, CS, CM> Freeze for FormCpt<FID, CID, CA, CS, CM>
where Form<FID>: Freeze, HashMap<FID, Box<dyn InputCpt<CID, CA, CS, CM>>>: Freeze, Option<FID>: Freeze,

§

impl<FID, CID, CA, CS, CM> Unpin for FormCpt<FID, CID, CA, CS, CM>
where Form<FID>: Unpin, HashMap<FID, Box<dyn InputCpt<CID, CA, CS, CM>>>: Unpin, Option<FID>: Unpin,

§

impl<FID, CID, CA, CS, CM> UnsafeUnpin for FormCpt<FID, CID, CA, CS, CM>
where Form<FID>: UnsafeUnpin, HashMap<FID, Box<dyn InputCpt<CID, CA, CS, CM>>>: UnsafeUnpin, Option<FID>: UnsafeUnpin,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more