Struct rkyv::with::Atomic

source ·
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§

source§

impl ArchiveWith<AtomicBool> for Atomic

§

type Archived = AtomicBool

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

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
source§

impl ArchiveWith<AtomicI16> for Atomic

§

type Archived = AtomicI16

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicI16, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicI32> for Atomic

§

type Archived = AtomicI32

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicI32, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicI64> for Atomic

§

type Archived = AtomicI64

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicI64, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicI8> for Atomic

§

type Archived = AtomicI8

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicI8, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicIsize> for Atomic

§

type Archived = <With<AtomicI32, Atomic> as Archive>::Archived

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

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
source§

impl ArchiveWith<AtomicU16> for Atomic

§

type Archived = AtomicU16

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicU16, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicU32> for Atomic

§

type Archived = AtomicU32

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicU32, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicU64> for Atomic

§

type Archived = AtomicU64

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicU64, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicU8> for Atomic

§

type Archived = AtomicU8

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &AtomicU8, _: usize, _: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl ArchiveWith<AtomicUsize> for Atomic

§

type Archived = <With<AtomicU32, Atomic> as Archive>::Archived

The archived type of a With<F, Self>.
§

type Resolver = ()

The resolver of a With<F, Self>.
source§

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
source§

impl Debug for Atomic

source§

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

Formats the value using the given formatter. Read more
source§

impl<D: Fallible + ?Sized> DeserializeWith<<Atomic as ArchiveWith<AtomicU32>>::Archived, AtomicUsize, D> for Atomic

source§

fn deserialize_with( field: &<Self as ArchiveWith<AtomicU32>>::Archived, _: &mut D ) -> Result<AtomicUsize, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI16, Atomic> as Archive>::Archived, AtomicI16, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicI16, Self>>, _: &mut D ) -> Result<AtomicI16, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI32, Atomic> as Archive>::Archived, AtomicI32, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicI32, Self>>, _: &mut D ) -> Result<AtomicI32, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicI64, Atomic> as Archive>::Archived, AtomicI64, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicI64, Self>>, _: &mut D ) -> Result<AtomicI64, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicIsize, Atomic> as Archive>::Archived, AtomicIsize, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicIsize, Self>>, _: &mut D ) -> Result<AtomicIsize, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU16, Atomic> as Archive>::Archived, AtomicU16, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicU16, Self>>, _: &mut D ) -> Result<AtomicU16, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU32, Atomic> as Archive>::Archived, AtomicU32, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicU32, Self>>, _: &mut D ) -> Result<AtomicU32, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<<With<AtomicU64, Atomic> as Archive>::Archived, AtomicU64, D> for Atomic

source§

fn deserialize_with( field: &Archived<With<AtomicU64, Self>>, _: &mut D ) -> Result<AtomicU64, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<AtomicBool, AtomicBool, D> for Atomic

source§

fn deserialize_with( field: &AtomicBool, _: &mut D ) -> Result<AtomicBool, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<AtomicI8, AtomicI8, D> for Atomic

source§

fn deserialize_with(field: &AtomicI8, _: &mut D) -> Result<AtomicI8, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<D: Fallible + ?Sized> DeserializeWith<AtomicU8, AtomicU8, D> for Atomic

source§

fn deserialize_with(field: &AtomicU8, _: &mut D) -> Result<AtomicU8, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicBool, S> for Atomic

source§

fn serialize_with(_: &AtomicBool, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicI16, S> for Atomic

source§

fn serialize_with(_: &AtomicI16, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicI32, S> for Atomic

source§

fn serialize_with(_: &AtomicI32, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicI64, S> for Atomic

source§

fn serialize_with(_: &AtomicI64, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicI8, S> for Atomic

source§

fn serialize_with(_: &AtomicI8, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicIsize, S> for Atomic

source§

fn serialize_with( _: &AtomicIsize, _: &mut S ) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicU16, S> for Atomic

source§

fn serialize_with(_: &AtomicU16, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicU32, S> for Atomic

source§

fn serialize_with(_: &AtomicU32, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicU64, S> for Atomic

source§

fn serialize_with(_: &AtomicU64, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicU8, S> for Atomic

source§

fn serialize_with(_: &AtomicU8, _: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<S: Fallible + ?Sized> SerializeWith<AtomicUsize, S> for Atomic

source§

fn serialize_with( _: &AtomicUsize, _: &mut S ) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.

Auto Trait Implementations§

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> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
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> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.