Use SharedString for Inputs

This commit is contained in:
Marshall Bowers 2023-10-18 14:28:28 -04:00
parent 5a42ca6772
commit 549e78d7b3

View file

@ -13,17 +13,17 @@ pub enum InputVariant {
#[derive(Element)] #[derive(Element)]
pub struct Input<S: 'static + Send + Sync> { pub struct Input<S: 'static + Send + Sync> {
state_type: PhantomData<S>, state_type: PhantomData<S>,
placeholder: &'static str, placeholder: SharedString,
value: String, value: String,
state: InteractionState, state: InteractionState,
variant: InputVariant, variant: InputVariant,
} }
impl<S: 'static + Send + Sync> Input<S> { impl<S: 'static + Send + Sync> Input<S> {
pub fn new(placeholder: &'static str) -> Self { pub fn new(placeholder: impl Into<SharedString>) -> Self {
Self { Self {
state_type: PhantomData, state_type: PhantomData,
placeholder, placeholder: placeholder.into(),
value: "".to_string(), value: "".to_string(),
state: InteractionState::default(), state: InteractionState::default(),
variant: InputVariant::default(), variant: InputVariant::default(),