pub struct CompilationResultSend { /* private fields */ }Expand description
A CompilationResult that can be sent to another thread.
A CompilationResult is not Send: it shares its compilation unit between
its components with an Rc. Convert one with
CompilationResult::into_send(), move it to the thread that will
instantiate the components, and convert it back with From. That way a
component can be compiled on a worker thread and instantiated on the thread
running the event loop.
let source = "export component App inherits Window { out property <int> v: 42; }".into();
let sent = std::thread::spawn(move || {
let compiler = slint_interpreter::Compiler::default();
spin_on::spin_on(compiler.build_from_source(source, Default::default())).into_send()
})
.join()
.unwrap();
let result = slint_interpreter::CompilationResult::from(sent);
let instance = result.component("App").unwrap().create().unwrap();Implementations§
Source§impl CompilationResultSend
impl CompilationResultSend
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Returns true if the compilation failed.
Sourcepub fn diagnostics(&self) -> impl Iterator<Item = Diagnostic> + '_
pub fn diagnostics(&self) -> impl Iterator<Item = Diagnostic> + '_
The diagnostics (errors and warnings) the compilation produced.
Sourcepub fn print_diagnostics(&self)
Available on crate feature display-diagnostics only.
pub fn print_diagnostics(&self)
display-diagnostics only.Print the diagnostics to stderr, in the same style as rustc errors.
Trait Implementations§
Source§impl From<CompilationResultSend> for CompilationResult
impl From<CompilationResultSend> for CompilationResult
Source§fn from(sent: CompilationResultSend) -> Self
fn from(sent: CompilationResultSend) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for CompilationResultSend
impl !Sync for CompilationResultSend
impl !UnwindSafe for CompilationResultSend
impl Freeze for CompilationResultSend
impl Send for CompilationResultSend
impl Unpin for CompilationResultSend
impl UnsafeUnpin for CompilationResultSend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.