ros666::utils::safety

Struct SyncRefCell

Source
pub struct SyncRefCell<T> {
    pub ref_cell: RefCell<T>,
}
Expand description

一个线程安全的 RefCell 包装器。

“I Promise I’m Safe RefCell :)”

Fields§

§ref_cell: RefCell<T>

Implementations§

Source§

impl SyncRefCell<ProcessControlBlock>

Source

pub fn fork( self: &Arc<SyncRefCell<ProcessControlBlock>>, ) -> Arc<SyncRefCell<ProcessControlBlock>>

创建子进程

§返回值

返回子进程的引用

Source

pub fn exec( self: &Arc<SyncRefCell<ProcessControlBlock>>, app_data: &[u8], args: Vec<String>, )

在当前进程上执行应用程序

§参数
  • app_data: 应用程序数据
Source§

impl<T> SyncRefCell<T>

Source

pub fn new(t: T) -> Self

创建一个新的 SyncRefCell 实例。

§参数
  • t - 要存储在 SyncRefCell 中的值。
§返回值

返回一个包含给定值的 SyncRefCell 实例。

Source

pub fn inner_borrow_mut(&self) -> RefMut<'_, T>

获取对内部值的可变引用。

§返回

返回一个可变引用,允许修改内部值。

§安全性

如果已经有不可变引用存在,则此方法会导致运行时 Panic。

Source

pub fn inner_borrow(&self) -> Ref<'_, T>

获取对内部值的不可变引用。

§返回

返回一个不可变引用,允许读取内部值。

§安全性

如果已经有可变引用存在,则此方法会导致运行时 Panic。

Trait Implementations§

Source§

impl<T> Sync for SyncRefCell<T>

Auto Trait Implementations§

§

impl<T> !Freeze for SyncRefCell<T>

§

impl<T> !RefUnwindSafe for SyncRefCell<T>

§

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

§

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

§

impl<T> UnwindSafe for SyncRefCell<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.