pub struct WindowCommandBus { /* private fields */ }Expand description
宿主与窗口之间共享的命令队列。
Arc<Mutex<..>> 只为满足类型上的 Send(命令都在 UI 线程产生与消费),
不需要真正的并发。
Implementations§
Source§impl WindowCommandBus
impl WindowCommandBus
pub fn new() -> WindowCommandBus
Sourcepub fn send(&self, window: impl Into<String>, command: WindowCommand)
pub fn send(&self, window: impl Into<String>, command: WindowCommand)
投递一条命令;window 是 WindowSpec::with_name 里的名字。
Sourcepub fn drain(&self) -> Vec<(String, WindowCommand)>
pub fn drain(&self) -> Vec<(String, WindowCommand)>
宿主消费全部待处理命令(取走即清空)。
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Trait Implementations§
Source§impl Clone for WindowCommandBus
impl Clone for WindowCommandBus
Source§fn clone(&self) -> WindowCommandBus
fn clone(&self) -> WindowCommandBus
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for WindowCommandBus
impl Default for WindowCommandBus
Source§fn default() -> WindowCommandBus
fn default() -> WindowCommandBus
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Forget for WindowCommandBus
impl Freeze for WindowCommandBuswhere
*const ArcInner<Mutex<Vec<(String, WindowCommand)>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<Vec<(String, WindowCommand)>>>>: Freeze,
impl Move for WindowCommandBus
impl RefUnwindSafe for WindowCommandBus
impl Send for WindowCommandBus
impl Sync for WindowCommandBus
impl Unpin for WindowCommandBus
impl UnsafeUnpin for WindowCommandBuswhere
*const ArcInner<Mutex<Vec<(String, WindowCommand)>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Vec<(String, WindowCommand)>>>>: UnsafeUnpin,
impl UnwindSafe for WindowCommandBus
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