Owned

Struct Owned 

Source
pub struct Owned<T, A: Allocator> { /* private fields */ }
Expand description

An owned to a value T in the ARENA.

Implementations§

Source§

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

Source

pub fn write(&mut self, value: T)

Write a value to the RefMut.

Source

pub unsafe fn as_ref(&self) -> &T

Returns a shared reference to the value.

§Safety
  • The value must be initialized.
Source

pub unsafe fn as_mut(&mut self) -> &mut T

Returns a mutable reference to the value.

§Safety
  • The value must be initialized.
Source

pub fn as_mut_ptr(&mut self) -> NonNull<T>

Returns the pointer to the T, the pointer may not be initialized. If the pointer is not initialized, then NonNull::dangling() is returned.

Trait Implementations§

Source§

impl<T, A: Allocator> Buffer for Owned<T, A>

Source§

fn capacity(&self) -> usize

Returns how many bytes of T occupies.

If this value is 0, then the T is ZST (zero sized type).

Source§

fn offset(&self) -> usize

Returns the offset of T to the pointer of the ARENA.

If this value is 0, then the T is ZST (zero sized type).

Source§

fn buffer_capacity(&self) -> usize

Returns how many bytes of buffer the value occupies.

If this value is 0, then the T is ZST (zero sized type).

Source§

fn buffer_offset(&self) -> usize

Returns the offset to the pointer of the ARENA.

If this value is 0, then the T is ZST (zero sized type).

Source§

fn flush_async(&self) -> Result<()>

Available on crate feature memmap and non-target_family="wasm" only.

Asynchronously flush the buffer to the disk.

Source§

unsafe fn detach(&mut self)

Detach the value from the ARENA, which means when the value is dropped, the underlying buffer will not be collected for futhur allocation. Read more
Source§

fn flush(&self) -> Result<()>

Available on crate feature memmap and non-target_family="wasm" only.
Flush the buffer to the disk.
Source§

impl<T: Debug, A: Debug + Allocator> Debug for Owned<T, A>

Source§

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

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

impl<T, A: Allocator> Drop for Owned<T, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<A: Allocator + Send, T> Send for Owned<T, A>

Source§

impl<A: Allocator + Sync, T> Sync for Owned<T, A>

Auto Trait Implementations§

§

impl<T, A> Freeze for Owned<T, A>
where A: Freeze, T: Freeze,

§

impl<T, A> RefUnwindSafe for Owned<T, A>

§

impl<T, A> Unpin for Owned<T, A>
where A: Unpin, T: Unpin,

§

impl<T, A> UnwindSafe for Owned<T, A>

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<K, Q> Comparable<Q> for K
where K: Borrow<Q> + ?Sized, Q: Ord + ?Sized,

Source§

fn compare(&self, key: &Q) -> Ordering

Compare self to key and return their ordering.
Source§

impl<K, Q> Equivalent<Q> for K
where K: Borrow<Q> + ?Sized, Q: Eq + ?Sized,

Source§

fn equivalent(&self, key: &Q) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more