feat(input): add generic type for other input components

This commit is contained in:
doryan 2024-08-14 18:53:27 +04:00
parent 06439585eb
commit d3327a7c36

View File

@ -41,9 +41,9 @@ macro_rules! build_for {
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Input { pub struct Input<I> {
component: Box, component: Box,
input: TextView, input: I,
input_label: Label, input_label: Label,
input_frame: Frame, input_frame: Frame,
} }
@ -54,7 +54,7 @@ pub struct InputBuilder {
margins: MarginData, margins: MarginData,
} }
impl Product<InputBuilder, Box> for Input { impl<I> Product<InputBuilder, Box> for Input<I> {
fn builder() -> InputBuilder { fn builder() -> InputBuilder {
InputBuilder { InputBuilder {
align: Alignment { align: Alignment {
@ -71,13 +71,13 @@ impl Product<InputBuilder, Box> for Input {
} }
} }
impl Input { impl<I> Input<I> {
pub fn get_input(&self) -> &TextView {
&self.input
} }
pub fn get_frame(&self) -> &Frame { pub fn get_frame(&self) -> &Frame {
&self.input_frame &self.input_frame
pub fn get_input(&self) -> &I {
&self.input
} }
pub fn get_label(&self) -> &Label { pub fn get_label(&self) -> &Label {