Struct slint_interpreter::ComponentDefinition
source · pub struct ComponentDefinition { /* private fields */ }
Expand description
ComponentDefinition is a representation of a compiled component from .slint markup.
It can be constructed from a .slint file using the Compiler::build_from_path
or Compiler::build_from_source
functions.
And then it can be instantiated with the Self::create
function.
The ComponentDefinition acts as a factory to create new instances. When you’ve finished creating the instances it is safe to drop the ComponentDefinition.
Implementations§
source§impl ComponentDefinition
impl ComponentDefinition
sourcepub fn create(&self) -> Result<ComponentInstance, PlatformError>
pub fn create(&self) -> Result<ComponentInstance, PlatformError>
Creates a new instance of the component and returns a shared handle to it.
sourcepub fn properties(&self) -> impl Iterator<Item = (String, ValueType)> + '_
pub fn properties(&self) -> impl Iterator<Item = (String, ValueType)> + '_
Returns an iterator over all publicly declared properties. Each iterator item is a tuple of property name and property type for each of them.
sourcepub fn callbacks(&self) -> impl Iterator<Item = String> + '_
pub fn callbacks(&self) -> impl Iterator<Item = String> + '_
Returns the names of all publicly declared callbacks.
sourcepub fn functions(&self) -> impl Iterator<Item = String> + '_
pub fn functions(&self) -> impl Iterator<Item = String> + '_
Returns the names of all publicly declared functions.
sourcepub fn globals(&self) -> impl Iterator<Item = String> + '_
pub fn globals(&self) -> impl Iterator<Item = String> + '_
Returns the names of all exported global singletons
Note: Only globals that are exported or re-exported from the main .slint file will be exposed in the API
sourcepub fn global_properties(
&self,
global_name: &str,
) -> Option<impl Iterator<Item = (String, ValueType)> + '_>
pub fn global_properties( &self, global_name: &str, ) -> Option<impl Iterator<Item = (String, ValueType)> + '_>
List of publicly declared properties in the exported global singleton specified by its name.
sourcepub fn global_callbacks(
&self,
global_name: &str,
) -> Option<impl Iterator<Item = String> + '_>
pub fn global_callbacks( &self, global_name: &str, ) -> Option<impl Iterator<Item = String> + '_>
List of publicly declared callbacks in the exported global singleton specified by its name.
sourcepub fn global_functions(
&self,
global_name: &str,
) -> Option<impl Iterator<Item = String> + '_>
pub fn global_functions( &self, global_name: &str, ) -> Option<impl Iterator<Item = String> + '_>
List of publicly declared functions in the exported global singleton specified by its name.
sourcepub fn type_loader(&self) -> Rc<TypeLoader>
pub fn type_loader(&self) -> Rc<TypeLoader>
Return the TypeLoader
used when parsing the code in the interpreter.
WARNING: this is not part of the public API
sourcepub fn raw_type_loader(&self) -> Option<TypeLoader>
pub fn raw_type_loader(&self) -> Option<TypeLoader>
Return the TypeLoader
used when parsing the code in the interpreter in
a state before most passes were applied by the compiler.
Each returned type loader is a deep copy of the entire state connected to it, so this is a fairly expensive function!
WARNING: this is not part of the public API
Trait Implementations§
source§impl Clone for ComponentDefinition
impl Clone for ComponentDefinition
source§fn clone(&self) -> ComponentDefinition
fn clone(&self) -> ComponentDefinition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ComponentDefinition
impl !RefUnwindSafe for ComponentDefinition
impl !Send for ComponentDefinition
impl !Sync for ComponentDefinition
impl Unpin for ComponentDefinition
impl !UnwindSafe for ComponentDefinition
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more