pub struct Boundary {
pub id: NodeId,
pub compute: Rc<RefCell<dyn FnMut() -> View>>,
}Expand description
Represents a dynamic UI boundary.
ⓘ
use std::sync::mpsc;
use std::rc::Rc;
use std::cell::RefCell;
use threadloom_core::{Boundary, NodeId, View};
// This test proves that Boundary cannot cross threads!
// If someone tries to send a Boundary over a channel, it will fail to compile
// because Boundary contains an Rc.
let (tx, rx) = mpsc::channel::<Boundary>();
std::thread::spawn(move || {
// tx is moved into the thread, requiring T (Boundary) to be Send
});Fields§
§id: NodeId§compute: Rc<RefCell<dyn FnMut() -> View>>Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Boundary
impl !Send for Boundary
impl !Sync for Boundary
impl !UnwindSafe for Boundary
impl Freeze for Boundary
impl Unpin for Boundary
impl UnsafeUnpin for Boundary
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