Skip to main content

Value

Struct Value 

Source
pub struct Value<T>(/* private fields */);
Expand description

Value whose stable extent fits a signed 32-bit count.

Admission requires an extent stable through shared access.

Implementations§

Source§

impl<const N: usize> Value<[u8; N]>

Source

pub const fn new(value: [u8; N]) -> Self

Source§

impl<T: Source> Value<T>

Source

pub fn try_new(value: T) -> Result<Self, Rejected<T>>

Source§

impl<'d> Value<Unique<'d>>

Source

pub fn try_take( &mut self, amount: NonZero<usize>, ) -> Result<Value<Prefix<'_, 'd>>, Error>

Source§

impl<T> Value<T>

Source

pub fn into_storage<U>(self) -> Value<U>
where T: Convert<U>,

Transfers storage while preserving its admitted extent.

Source

pub fn from_raw(proof: Input<T>) -> Self

Seals the original producer’s extent proof into its bytes.

Source

pub fn into_inner(self) -> T

Source§

impl<'d> Value<Shared<Owner<'d>>>

Source

pub fn try_get( &self, range: Range<usize>, budget: &Budget<'d>, ) -> Result<Value<Shared<Option<Account<'d>>>>, Error>

Source§

impl<'d> Value<Shared<Option<Account<'d>>>>

Source

pub fn try_clone(&self) -> Result<Self, Error>

Source

pub fn project(self, range: Range<usize>) -> Result<Self, Rejected<Self, Error>>

Source§

impl Value<&[u8]>

Source

pub fn try_get(&self, range: Range<usize>) -> Result<Self, Error>

Source§

impl<'a, S: ?Sized> Value<View<'a, S>>

Source

pub fn try_get(&self, range: Range<usize>) -> Result<Self, Error>

Source§

impl<'d> Value<View<'_, Shared<Option<Account<'d>>>>>

Trait Implementations§

Source§

impl<T: Mutable> AsMut<[u8]> for Value<T>

Source§

fn as_mut(&mut self) -> &mut [u8] ⓘ

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: AsRef<[u8]>> AsRef<[u8]> for Value<T>

Source§

fn as_ref(&self) -> &[u8] ⓘ

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<S: ?Sized> Clone for Value<View<'_, S>>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'d> Complete for Value<Unique<'d>>

Source§

fn view(&self) -> Self::View<'_>

Source§

impl<O: Unpin> Complete for Value<Shared<O>>

Source§

fn view(&self) -> Self::View<'_>

Source§

impl<T: Store + Source> Consume for Value<T>

Source§

fn remaining(&self) -> usize

Source§

fn try_consume(&mut self, amount: usize) -> Result<(), Error>

Source§

fn consume_max(&mut self, max: usize) -> usize

Source§

impl<T: Consume> Consume for Value<T>

Source§

fn consume<const MAX: u32>(prefix: Consumed<'_, '_, Self, MAX>)

Source§

impl<'d> Cursor for Value<Unique<'d>>

Source§

fn try_get<'input>( &'input self, range: Range<usize>, ) -> Result<Self::View<'input>, Error>

Validates a range once and retains its original source borrow.
Source§

impl<O: Unpin> Cursor for Value<Shared<O>>

Source§

fn try_get<'input>( &'input self, range: Range<usize>, ) -> Result<Self::View<'input>, Error>

Validates a range once and retains its original source borrow.
Source§

impl<T: Debug> Debug for Value<T>

Source§

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

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

impl Default for Value<Shared<Option<Account<'_>>>>

Source§

fn default() -> Self

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

impl<'a, 'd> Freeze for Value<Prefix<'a, 'd>>

Source§

type Output = Value<Prefix<'a, 'd, &'a [u8]>>

Source§

fn freeze(self) -> Self::Output

Source§

impl<T: AsRef<[u8]>> From<&Value<T>> for U32<0, { _ }>

Source§

fn from(bytes: &Value<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, 'd> From<Value<Prefix<'a, 'd>>> for Value<Prefix<'a, 'd, &'a [u8]>>

Source§

fn from(prefix: Value<Prefix<'a, 'd>>) -> Self

Converts to this type from the input type.
Source§

impl<'d> From<Value<Shared<Option<Account<'d>>>>> for Shared<'d>

Source§

fn from(bytes: Value<Shared<Option<Account<'d>>>>) -> Self

Converts to this type from the input type.
Source§

impl<'d> From<Value<Unique<'d>>> for Value<Shared<Owner<'d>>>

Source§

fn from(bytes: Value<Unique<'d>>) -> Self

Converts to this type from the input type.
Source§

impl<'d> Frozen<'d> for Value<Shared<Owner<'d>>>

Source§

type Account = Value<Shared<Option<Account<'d>>>>

Source§

fn try_account(&self, budget: &Budget<'d>) -> Result<Self::Account, Cause>

Source§

impl<'a, 'd> Frozen<'d> for Value<Prefix<'a, 'd, &'a [u8]>>

Source§

impl Mutable for Value<Unique<'_>>

Source§

impl Mutable for Value<Prefix<'_, '_>>

Source§

impl<'a, 'd> Mutable<'d> for Value<Prefix<'a, 'd>>

Source§

type Account = Value<Shared<Option<Account<'d>>>>

Source§

type Frozen = Value<Prefix<'a, 'd, &'a [u8]>>

Source§

type Prefix<'b> = Value<Prefix<'a, 'd>>
where Self: 'b,

Source§

fn try_take( &mut self, amount: NonZero<usize>, ) -> Result<Self::Prefix<'_>, Error>

Source§

impl<T: AsRef<[u8]>> Project<T> for Value<T>

Source§

fn as_inner(&self) -> &T

Source§

unsafe fn as_inner_mut(&mut self) -> &mut T

Safety Read more
Source§

impl<'a, T: Read<'a>> Read<'a> for Value<T>
where Self: Source,

Source§

fn as_slice(&self) -> &'a [u8] ⓘ

Source§

fn try_split<const N: usize>(self) -> Result<(&'a [u8; N], Self), Error>

Source§

impl<T: Residency> Residency for Value<T>

Source§

fn resident(&self) -> usize

Source§

impl<'d> Retain<'d> for Value<Shared<Owner<'d>>>

Source§

fn try_retain<'a>( plan: &Self::View<'a>, budget: &Budget<'d>, ) -> Result<Retained<'d>, Error>
where Self: 'a,

Retains this admitted extent with its original account and borrow domain.

Source§

fn charge<'a>(plan: &Self::View<'a>) -> Charge
where Self: 'a,

Bounds retained Residency by max(plan.len(), resident_bytes), including retries.
Source§

fn try_copy<'a>( plan: &Self::View<'a>, budget: &Budget<'d>, ) -> Result<Owned<Budget<'d>>, Error>
where Self: 'a,

Uniquely owns the copied bytes with output Residency at most their length.
Source§

impl<T: Source> Source for Value<Prefix<'_, '_, T>>

Source§

impl<O: Unpin> Source for Value<Shared<O>>

Source§

type View<'input> = Value<View<'input, Shared<O>>>
where Self: 'input,

Source§

fn remaining(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl<'d> Source for Value<Unique<'d>>

Source§

type View<'input> = Value<&'input [u8]>
where Self: 'input,

Source§

fn remaining(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl Split for Value<Prefix<'_, '_>>

Source§

impl<T: Store> Store for Value<T>

Source§

fn empty() -> Option<Self>

Returns a canonical empty owner, or None to restrict the current owner according to its own empty-storage policy. A returned owner must expose no bytes and require no allocation.
Source§

fn restrict(slice: Slice<'_, '_, Self>)

Applies the selected extent. Nonempty selections must retain their original backing; empty selections preserve this owner’s empty-storage policy.
Source§

fn advance<const MAX: u32>(prefix: Consumed<'_, '_, Self, MAX>)

Source§

fn advance_max(&mut self, max: usize) -> usize
where Self: Source,

Source§

fn project(slice: Slice<'_, '_, Self>)

Source§

impl<'a> TryFrom<&'a mut [MaybeUninit<u8>]> for Value<&'a mut [MaybeUninit<u8>]>

Source§

type Error = Overflow<{ MAX as u32 }>

The type returned in the event of a conversion error.
Source§

fn try_from(value: &'a mut [MaybeUninit<u8>]) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<T> Forget for Value<T>

§

impl<T> Freeze for Value<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Value<T>
where T: RefUnwindSafe,

§

impl<T> Send for Value<T>
where T: Send,

§

impl<T> Sync for Value<T>
where T: Sync,

§

impl<T> Unpin for Value<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Value<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Value<T>
where T: UnwindSafe,

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

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> Source for T
where T: Consume,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.