pub struct AtomicCell<T> { /* private fields */ }Expand description
Атомарная ячейка с полностью безопасным API
§Безопасность
- Конструктор гарантирует корректную инициализацию
- Все операции с памятью инкапсулированы
- Паника при невозможности создания (системная ошибка)
Implementations§
Source§impl<T> AtomicCell<T>
impl<T> AtomicCell<T>
Sourcepub fn load(&self) -> Twhere
T: Copy,
pub fn load(&self) -> Twhere
T: Copy,
Безопасно загрузить значение
§Safety
Этот метод безопасен, так как:
- Вызывается только когда нет одновременной записи
- Использует правильные гарантии памяти
Sourcepub fn store(&self, value: T)
pub fn store(&self, value: T)
Безопасно сохранить значение
§Safety
Этот метод безопасен, так как:
- Гарантируется уникальный доступ для записи
- Нет одновременного чтения
pub const fn new(value: T) -> AtomicCell<T>
Sourcepub fn try_new(value: T) -> Result<AtomicCell<T>, AtomicCellError>
pub fn try_new(value: T) -> Result<AtomicCell<T>, AtomicCellError>
Создать новую атомарную ячейку с проверкой
Trait Implementations§
Source§impl<T> Clone for AtomicCell<T>
impl<T> Clone for AtomicCell<T>
Source§fn clone(&self) -> AtomicCell<T>
fn clone(&self) -> AtomicCell<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for AtomicCell<T>
impl<T> Debug for AtomicCell<T>
Source§impl<T> Default for AtomicCell<T>where
T: Default,
impl<T> Default for AtomicCell<T>where
T: Default,
Source§fn default() -> AtomicCell<T>
fn default() -> AtomicCell<T>
Returns the “default value” for a type. Read more
impl<T> Send for AtomicCell<T>where
T: Send,
impl<T> Sync for AtomicCell<T>where
T: Sync,
Auto Trait Implementations§
impl<T> !Freeze for AtomicCell<T>
impl<T> !RefUnwindSafe for AtomicCell<T>
impl<T> Unpin for AtomicCell<T>where
T: Unpin,
impl<T> UnsafeUnpin for AtomicCell<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for AtomicCell<T>where
T: UnwindSafe,
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