pub struct Atomic;
Expand description
A wrapper that archives an atomic with an underlying atomic.
By default, atomics are archived with an underlying integer.
Safety
This wrapper is only safe to use when the backing memory for wrapped types is mutable.
Example
use core::sync::atomic::AtomicU32;
use rkyv::{Archive, with::Atomic};
#[derive(Archive)]
struct Example {
#[with(Atomic)]
a: AtomicU32,
}
Trait Implementations
sourceimpl ArchiveWith<AtomicBool> for Atomic
impl ArchiveWith<AtomicBool> for Atomic
type Archived = AtomicBool
type Archived = AtomicBool
The archived type of a With<F, Self>
.
sourceunsafe fn resolve_with(
field: &AtomicBool,
_: usize,
_: Self::Resolver,
out: *mut Self::Archived
)
unsafe fn resolve_with(
field: &AtomicBool,
_: usize,
_: Self::Resolver,
out: *mut Self::Archived
)
Resolves the archived type using a reference to the field type F
. Read more
sourceimpl ArchiveWith<AtomicI16> for Atomic
impl ArchiveWith<AtomicI16> for Atomic
sourceimpl ArchiveWith<AtomicI32> for Atomic
impl ArchiveWith<AtomicI32> for Atomic
sourceimpl ArchiveWith<AtomicI64> for Atomic
impl ArchiveWith<AtomicI64> for Atomic
sourceimpl ArchiveWith<AtomicI8> for Atomic
impl ArchiveWith<AtomicI8> for Atomic
sourceimpl ArchiveWith<AtomicIsize> for Atomic
impl ArchiveWith<AtomicIsize> for Atomic
sourceunsafe fn resolve_with(
field: &AtomicIsize,
_: usize,
_: Self::Resolver,
out: *mut Self::Archived
)
unsafe fn resolve_with(
field: &AtomicIsize,
_: usize,
_: Self::Resolver,
out: *mut Self::Archived
)
Resolves the archived type using a reference to the field type F
. Read more
sourceimpl ArchiveWith<AtomicU16> for Atomic
impl ArchiveWith<AtomicU16> for Atomic
sourceimpl ArchiveWith<AtomicU32> for Atomic
impl ArchiveWith<AtomicU32> for Atomic
sourceimpl ArchiveWith<AtomicU64> for Atomic
impl ArchiveWith<AtomicU64> for Atomic
sourceimpl ArchiveWith<AtomicU8> for Atomic
impl ArchiveWith<AtomicU8> for Atomic
sourceimpl ArchiveWith<AtomicUsize> for Atomic
impl ArchiveWith<AtomicUsize> for Atomic
sourceunsafe fn resolve_with(
field: &AtomicUsize,
_: usize,
_: Self::Resolver,
out: *mut Self::Archived
)
unsafe fn resolve_with(
field: &AtomicUsize,
_: usize,
_: Self::Resolver,
out: *mut Self::Archived
)
Resolves the archived type using a reference to the field type F
. Read more
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<Atomic as ArchiveWith<AtomicU32>>::Archived, AtomicUsize, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<Atomic as ArchiveWith<AtomicU32>>::Archived, AtomicUsize, D> for Atomic
sourcefn deserialize_with(
field: &<Self as ArchiveWith<AtomicU32>>::Archived,
_: &mut D
) -> Result<AtomicUsize, D::Error>
fn deserialize_with(
field: &<Self as ArchiveWith<AtomicU32>>::Archived,
_: &mut D
) -> Result<AtomicUsize, D::Error>
Deserializes the field type F
using the given deserializer.
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI16, Atomic> as Archive>::Archived, AtomicI16, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI16, Atomic> as Archive>::Archived, AtomicI16, D> for Atomic
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI32, Atomic> as Archive>::Archived, AtomicI32, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI32, Atomic> as Archive>::Archived, AtomicI32, D> for Atomic
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI64, Atomic> as Archive>::Archived, AtomicI64, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI64, Atomic> as Archive>::Archived, AtomicI64, D> for Atomic
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicIsize, Atomic> as Archive>::Archived, AtomicIsize, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicIsize, Atomic> as Archive>::Archived, AtomicIsize, D> for Atomic
sourcefn deserialize_with(
field: &Archived<With<AtomicIsize, Self>>,
_: &mut D
) -> Result<AtomicIsize, D::Error>
fn deserialize_with(
field: &Archived<With<AtomicIsize, Self>>,
_: &mut D
) -> Result<AtomicIsize, D::Error>
Deserializes the field type F
using the given deserializer.
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU16, Atomic> as Archive>::Archived, AtomicU16, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU16, Atomic> as Archive>::Archived, AtomicU16, D> for Atomic
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU32, Atomic> as Archive>::Archived, AtomicU32, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU32, Atomic> as Archive>::Archived, AtomicU32, D> for Atomic
sourceimpl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU64, Atomic> as Archive>::Archived, AtomicU64, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU64, Atomic> as Archive>::Archived, AtomicU64, D> for Atomic
sourceimpl<D: Fallible + ?Sized> DeserializeWith<AtomicBool, AtomicBool, D> for Atomic
impl<D: Fallible + ?Sized> DeserializeWith<AtomicBool, AtomicBool, D> for Atomic
sourcefn deserialize_with(
field: &AtomicBool,
_: &mut D
) -> Result<AtomicBool, D::Error>
fn deserialize_with(
field: &AtomicBool,
_: &mut D
) -> Result<AtomicBool, D::Error>
Deserializes the field type F
using the given deserializer.
sourceimpl<S: Fallible + ?Sized> SerializeWith<AtomicBool, S> for Atomic
impl<S: Fallible + ?Sized> SerializeWith<AtomicBool, S> for Atomic
sourcefn serialize_with(_: &AtomicBool, _: &mut S) -> Result<Self::Resolver, S::Error>
fn serialize_with(_: &AtomicBool, _: &mut S) -> Result<Self::Resolver, S::Error>
Serializes the field type F
using the given serializer.
sourceimpl<S: Fallible + ?Sized> SerializeWith<AtomicIsize, S> for Atomic
impl<S: Fallible + ?Sized> SerializeWith<AtomicIsize, S> for Atomic
sourcefn serialize_with(
_: &AtomicIsize,
_: &mut S
) -> Result<Self::Resolver, S::Error>
fn serialize_with(
_: &AtomicIsize,
_: &mut S
) -> Result<Self::Resolver, S::Error>
Serializes the field type F
using the given serializer.
sourceimpl<S: Fallible + ?Sized> SerializeWith<AtomicUsize, S> for Atomic
impl<S: Fallible + ?Sized> SerializeWith<AtomicUsize, S> for Atomic
sourcefn serialize_with(
_: &AtomicUsize,
_: &mut S
) -> Result<Self::Resolver, S::Error>
fn serialize_with(
_: &AtomicUsize,
_: &mut S
) -> Result<Self::Resolver, S::Error>
Serializes the field type F
using the given serializer.
Auto Trait Implementations
impl RefUnwindSafe for Atomic
impl Send for Atomic
impl Sync for Atomic
impl Unpin for Atomic
impl UnwindSafe for Atomic
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
fn pointer_metadata(_: &Self::ArchivedMetadata) -> <Self as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more