Skip to main content

UPIntrFreeCell

Struct UPIntrFreeCell 

Source
pub struct UPIntrFreeCell<T> { /* private fields */ }
Expand description

带中断屏蔽的内部可变性容器。

在访问内部数据时自动禁用中断,保证单处理器环境下的数据安全。

Implementations§

Source§

impl<T> UPIntrFreeCell<T>

Source

pub unsafe fn new(value: T) -> Self

创建一个新的 UPIntrFreeCell

§Safety

调用者必须确保此类型仅在单处理器环境下使用。

Source

pub fn exclusive_access(&self) -> UPIntrRefMut<'_, T>

Panic if the data has been borrowed.

Source

pub fn exclusive_session<F, V>(&self, f: F) -> V
where F: FnOnce(&mut T) -> V,

exclusive_session

Trait Implementations§

Auto Trait Implementations§

§

impl<T> !Freeze for UPIntrFreeCell<T>

§

impl<T> !RefUnwindSafe for UPIntrFreeCell<T>

§

impl<T> Send for UPIntrFreeCell<T>
where T: Send,

§

impl<T> Unpin for UPIntrFreeCell<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for UPIntrFreeCell<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for UPIntrFreeCell<T>
where T: UnwindSafe,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.