Struct relm4::RelmWorker
source · [−]pub struct RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait, { /* private fields */ }
Expand description
RelmWorker
s are like RelmComponent
s but they don’t have any widgets.
They are usually used to run expansive tasks on different threads and report back when they are finished
so that their parent components can keep handling UI events in the meantime.
For example you could use a RelmWorker
for sending a HTTP request or for copying files.
A RelmWorker
has its own model and message type
and can send messages to its parent and its children components.
Multiple RelmWorker
s that have the same parent are usually bundled along with RelmComponent
s
in a struct that implements Components
.
Implementations
sourceimpl<Model, ParentModel> RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait,
impl<Model, ParentModel> RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait,
sourceimpl<Model, ParentModel> RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + Send + 'static,
Model::Components: Send + 'static,
Model::Msg: Send,
ParentModel: ModelTrait,
ParentModel::Msg: Send,
impl<Model, ParentModel> RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + Send + 'static,
Model::Components: Send + 'static,
Model::Msg: Send,
ParentModel: ModelTrait,
ParentModel::Msg: Send,
sourcepub fn with_new_thread(
parent_model: &ParentModel,
parent_sender: Sender<ParentModel::Msg>
) -> Self
pub fn with_new_thread(
parent_model: &ParentModel,
parent_sender: Sender<ParentModel::Msg>
) -> Self
Create a new RelmWorker
that runs the ComponentUpdate::update
function in another thread.
Trait Implementations
sourceimpl<Model: Clone, ParentModel: Clone> Clone for RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait,
Model::Msg: Clone,
impl<Model: Clone, ParentModel: Clone> Clone for RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait,
Model::Msg: Clone,
sourcefn clone(&self) -> RelmWorker<Model, ParentModel>
fn clone(&self) -> RelmWorker<Model, ParentModel>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<Model: Debug, ParentModel: Debug> Debug for RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait,
Model::Msg: Debug,
impl<Model: Debug, ParentModel: Debug> Debug for RelmWorker<Model, ParentModel> where
Model: ComponentUpdate<ParentModel, Widgets = ()> + 'static,
ParentModel: ModelTrait,
Model::Msg: Debug,
Auto Trait Implementations
impl<Model, ParentModel> RefUnwindSafe for RelmWorker<Model, ParentModel> where
Model: RefUnwindSafe,
ParentModel: RefUnwindSafe,
impl<Model, ParentModel> Send for RelmWorker<Model, ParentModel> where
Model: Send,
ParentModel: Send,
<Model as Model>::Msg: Send,
impl<Model, ParentModel> Sync for RelmWorker<Model, ParentModel> where
Model: Sync,
ParentModel: Sync,
<Model as Model>::Msg: Send,
impl<Model, ParentModel> Unpin for RelmWorker<Model, ParentModel> where
Model: Unpin,
ParentModel: Unpin,
impl<Model, ParentModel> UnwindSafe for RelmWorker<Model, ParentModel> where
Model: UnwindSafe,
ParentModel: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more