pub struct RustdvShared<T> { /* private fields */ }Expand description
A handle to state shared between a component and its analysis port.
Cloning gives another handle to the same state, the way Rc does — it
does not copy the data.
Implementations§
pub fn new(value: T) -> RustdvShared<T>
Sourcepub fn get(&self) -> Ref<'_, T>
pub fn get(&self) -> Ref<'_, T>
Read the shared state.
The guard borrows at run time, so holding one across a call that also
reads is fine and holding one across a call that writes panics. Keep
the guard short — usually one line, as in
let seen = self.tally.get();.
Sourcepub fn handle_count(&self) -> usize
pub fn handle_count(&self) -> usize
How many handles point at this state — the component’s, the port’s, and any others.
Trait Implementations§
Auto Trait Implementations§
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