Struct i_slint_core::component_factory::ComponentFactory
source · 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)