Implement From<Style> for container::StyleFn
Co-authored-by: wiiznokes <78230769+wiiznokes@users.noreply.github.com>
This commit is contained in:
parent
feff4d1cba
commit
9d7aa11623
1 changed files with 6 additions and 0 deletions
|
|
@ -612,6 +612,12 @@ pub trait Catalog {
|
|||
/// A styling function for a [`Container`].
|
||||
pub type StyleFn<'a, Theme> = Box<dyn Fn(&Theme) -> Style + 'a>;
|
||||
|
||||
impl<'a, Theme> From<Style> for StyleFn<'a, Theme> {
|
||||
fn from(style: Style) -> Self {
|
||||
Box::new(move |_theme| style)
|
||||
}
|
||||
}
|
||||
|
||||
impl Catalog for Theme {
|
||||
type Class<'a> = StyleFn<'a, Self>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue