Use SharedString
for Button
s
This commit is contained in:
parent
aa41f97e38
commit
6e3393c93f
1 changed files with 3 additions and 9 deletions
|
@ -35,7 +35,7 @@ impl<S: 'static + Send + Sync> Default for ButtonHandlers<S> {
|
||||||
#[derive(Element)]
|
#[derive(Element)]
|
||||||
pub struct Button<S: 'static + Send + Sync + Clone> {
|
pub struct Button<S: 'static + Send + Sync + Clone> {
|
||||||
state_type: PhantomData<S>,
|
state_type: PhantomData<S>,
|
||||||
label: String,
|
label: SharedString,
|
||||||
variant: ButtonVariant,
|
variant: ButtonVariant,
|
||||||
state: InteractionState,
|
state: InteractionState,
|
||||||
icon: Option<Icon>,
|
icon: Option<Icon>,
|
||||||
|
@ -45,10 +45,7 @@ pub struct Button<S: 'static + Send + Sync + Clone> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: 'static + Send + Sync + Clone> Button<S> {
|
impl<S: 'static + Send + Sync + Clone> Button<S> {
|
||||||
pub fn new<L>(label: L) -> Self
|
pub fn new(label: impl Into<SharedString>) -> Self {
|
||||||
where
|
|
||||||
L: Into<String>,
|
|
||||||
{
|
|
||||||
Self {
|
Self {
|
||||||
state_type: PhantomData,
|
state_type: PhantomData,
|
||||||
label: label.into(),
|
label: label.into(),
|
||||||
|
@ -61,10 +58,7 @@ impl<S: 'static + Send + Sync + Clone> Button<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ghost<L>(label: L) -> Self
|
pub fn ghost(label: impl Into<SharedString>) -> Self {
|
||||||
where
|
|
||||||
L: Into<String>,
|
|
||||||
{
|
|
||||||
Self::new(label).variant(ButtonVariant::Ghost)
|
Self::new(label).variant(ButtonVariant::Ghost)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue