Struct arsc_rs::Arsc

source ·
pub struct Arsc<T: ?Sized, A: Allocator = Global> { /* private fields */ }

Implementations§

source§

impl<T, A: Allocator> Arsc<T, A>

source

pub fn try_new_in(data: T, alloc: A) -> Result<Self, AllocError>

source

pub fn try_new_uninit_in( alloc: A ) -> Result<Arsc<MaybeUninit<T>, A>, AllocError>

source§

impl<T> Arsc<T, Global>

source

pub fn try_new(data: T) -> Result<Self, AllocError>

source

pub fn new(data: T) -> Self

source

pub fn pin(data: T) -> Pin<Self>

source

pub fn try_new_uninit() -> Result<Arsc<MaybeUninit<T>, Global>, AllocError>

source

pub fn try_unwrap(this: Self) -> Result<T, Self>

source§

impl<T, A: Allocator> Arsc<MaybeUninit<T>, A>

source

pub unsafe fn assume_init(this: Self) -> Arsc<T, A>

Safety

The caller must ensure a valid value of T stored in the Arsc.

source§

impl<T: ?Sized, A: Allocator> Arsc<T, A>

source

pub fn ptr_eq(a: &Self, b: &Self) -> bool

source

pub fn as_ptr(this: &Self) -> *const T

source

pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T

Safety

The caller must ensure the exclusiveness of the mutable reference.

source

pub fn get_mut(this: &mut Self) -> Option<&mut T>

source§

impl<T> Arsc<T, Global>

source

pub fn into_raw(this: Self) -> *const T

source

pub unsafe fn from_raw(ptr: *const T) -> Self

Safety

The raw pointer must have been previously returned by a call to Arsc<U>::into_raw where U must have the same size and alignment as T. This is trivially true if U is T. Note that if U is not T but has the same size and alignment, this is basically like transmuting references of different types. See mem::transmute for more information on what restrictions apply in this case.

source§

impl<T, A: Allocator> Arsc<T, A>

source

pub fn try_make_mut_with<F, E>(this: &mut Self, clone: F) -> Result<&mut T, E>where E: From<AllocError>, F: FnOnce(&T) -> Result<(T, A), E>,

source

pub fn try_make_mut(this: &mut Self) -> Result<&mut T, AllocError>where T: Clone, A: Clone,

source

pub fn count(this: &Self) -> usize

source§

impl<A: Allocator> Arsc<dyn Any, A>

source

pub fn downcast<T: Any>(self) -> Result<Arsc<T, A>, Self>

source§

impl<A: Allocator> Arsc<dyn Any + Send + Sync, A>

source

pub fn downcast<T: Any + Send + Sync>(self) -> Result<Arsc<T, A>, Self>

Trait Implementations§

source§

impl<T: ?Sized, A: Allocator> Clone for Arsc<T, A>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ?Sized + Debug, A: Allocator> Debug for Arsc<T, A>

source§

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

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

impl<T: Default> Default for Arsc<T, Global>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: ?Sized, A: Allocator> Deref for Arsc<T, A>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: ?Sized, A: Allocator> Drop for Arsc<T, A>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: ?Sized + Ord, A: Allocator> Ord for Arsc<T, A>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<T: ?Sized + PartialEq, A: Allocator> PartialEq<Arsc<T, A>> for Arsc<T, A>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd<Arsc<T, A>> for Arsc<T, A>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Arsc<U, A>> for Arsc<T, A>

source§

impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> DispatchFromDyn<Arsc<U, A>> for Arsc<T, A>

source§

impl<T: ?Sized + Eq, A: Allocator> Eq for Arsc<T, A>

source§

impl<T: ?Sized + Send + Sync, A: Allocator + Send + Sync> Send for Arsc<T, A>

source§

impl<T: ?Sized + Send + Sync, A: Allocator + Send + Sync> Sync for Arsc<T, A>

Auto Trait Implementations§

§

impl<T: ?Sized, A> RefUnwindSafe for Arsc<T, A>where A: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T: ?Sized, A> Unpin for Arsc<T, A>where A: Unpin, T: Unpin,

§

impl<T: ?Sized, A> UnwindSafe for Arsc<T, A>where A: UnwindSafe + RefUnwindSafe, T: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.