Skip to main content

SharedPublication

Struct SharedPublication 

Source
pub struct SharedPublication<Value> { /* private fields */ }
Expand description

Briefly retains one captured reference and its reload coordinator.

Drop this prepared owner outside external control fences: it may be the final reference owner, whose value/resource destructors can run arbitrary code.

Implementations§

Source§

impl<Value> SharedPublication<Value>

Source

pub fn try_replace(&self, value: &mut Value) -> Result<bool, SharedAccessError>

Swaps the captured value with the caller’s value without dropping either.

On success the slot contains the displaced value; otherwise it is unchanged. This lets an external cancellation owner hold its commit fence over the swap, then release that fence before dropping the displaced value. No user callback or value destructor runs here. Successful swaps supersede reloads.

§Errors

Returns Busy or Poisoned without changing the slot or reload authority.

Trait Implementations§

Source§

impl<Value> Debug for SharedPublication<Value>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Value> !RefUnwindSafe for SharedPublication<Value>

§

impl<Value> !UnwindSafe for SharedPublication<Value>

§

impl<Value> Forget for SharedPublication<Value>

§

impl<Value> Freeze for SharedPublication<Value>
where *const ArcInner<SharedReference<Value>> is !null: Freeze, PhantomData<ArcInner<SharedReference<Value>>>: Freeze, *const ArcInner<Mutex<Option<Weak<()>>>> is !null: Freeze, PhantomData<ArcInner<Mutex<Option<Weak<()>>>>>: Freeze,

§

impl<Value> Move for SharedPublication<Value>

§

impl<Value> Send for SharedPublication<Value>
where Arc<SharedReference<Value>>: Send, Arc<Mutex<Option<Weak<()>>>>: Send,

§

impl<Value> Sync for SharedPublication<Value>
where Arc<SharedReference<Value>>: Sync, Arc<Mutex<Option<Weak<()>>>>: Sync,

§

impl<Value> Unpin for SharedPublication<Value>
where Arc<SharedReference<Value>>: Unpin, Arc<Mutex<Option<Weak<()>>>>: Unpin,

§

impl<Value> UnsafeUnpin for SharedPublication<Value>
where *const ArcInner<SharedReference<Value>> is !null: UnsafeUnpin, PhantomData<ArcInner<SharedReference<Value>>>: UnsafeUnpin, *const ArcInner<Mutex<Option<Weak<()>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Option<Weak<()>>>>>: UnsafeUnpin,

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.