Skip to main content

PluginCell

Struct PluginCell 

Source
pub struct PluginCell<T> { /* private fields */ }

Implementations§

Source§

impl<T> PluginCell<T>

Source

pub fn new(value: T) -> Self

Source

pub fn enter(&self) -> PluginGuard<'_, T>

Take ownership. Never blocks: the previous owner has already released, by the host contract. The Acquire observes its writes.

Source

pub fn try_enter(&self) -> Option<PluginGuard<'_, T>>

Take ownership only if the cell is free, returning None when it is already held. Unlike Self::enter this never asserts and never hands out a second &mut - it is the safe primitive for paths where author code may re-enter the cell (a request_resize closure invoked synchronously from within an Editor method the wrapper called while holding the guard). Callers defer the work (stash it and apply on the next entry) when they get None.

§Invariant

try_enter only defends against same-thread re-entry. Release Self::enter swaps held to true unconditionally and ignores the prior value (it trusts the host contract), so an enter that overlapped a try_enter on another thread would barge in past a live guard with no signal. Every owner of a given cell must therefore run on one logical thread of control: today the audio cell uses only enter (audio thread, host-serialized) and the gui cell uses enter + try_enter only on the host GUI thread. Do not mix enter on one thread with try_enter on another for the same cell.

Trait Implementations§

Source§

impl<T: Send> Send for PluginCell<T>

Source§

impl<T: Send> Sync for PluginCell<T>

Auto Trait Implementations§

§

impl<T> !Freeze for PluginCell<T>

§

impl<T> !RefUnwindSafe for PluginCell<T>

§

impl<T> Unpin for PluginCell<T>
where UnsafeCell<T>: Unpin,

§

impl<T> UnsafeUnpin for PluginCell<T>

§

impl<T> UnwindSafe for PluginCell<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.