pub struct ComponentFactory(/* private fields */);
Expand description
A ComponentFactory
can be used to create new Components at runtime,
taking a factory function returning a ComponentHandle
.
The FactoryContext
is passed to that factory function.
A ComponentFactory
implements the component-factory
type for
properties in the Slint language.
The component-factory
is used by an ComponentContainer
element in Slint
files to embed UI elements based on the produced component within the
ComponentContainer
element.
Implementations§
Source§impl ComponentFactory
impl ComponentFactory
Sourcepub fn new<T: ComponentHandle + 'static>(
factory: impl Fn(FactoryContext) -> Option<T> + 'static,
) -> Self
pub fn new<T: ComponentHandle + 'static>( factory: impl Fn(FactoryContext) -> Option<T> + 'static, ) -> Self
Create a new ComponentFactory
Trait Implementations§
Source§impl Clone for ComponentFactory
impl Clone for ComponentFactory
Source§fn clone(&self) -> ComponentFactory
fn clone(&self) -> ComponentFactory
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ComponentFactory
impl Debug for ComponentFactory
Source§impl Default for ComponentFactory
impl Default for ComponentFactory
Source§fn default() -> ComponentFactory
fn default() -> ComponentFactory
Returns the “default value” for a type. Read more
Source§impl PartialEq for ComponentFactory
impl PartialEq for ComponentFactory
impl StructuralPartialEq for ComponentFactory
Auto Trait Implementations§
impl Freeze for ComponentFactory
impl !RefUnwindSafe for ComponentFactory
impl !Send for ComponentFactory
impl !Sync for ComponentFactory
impl Unpin for ComponentFactory
impl !UnwindSafe for ComponentFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more