Skip to main content

Orphan

Struct Orphan 

Source
pub struct Orphan<T> { /* private fields */ }
Expand description

A container for a single, non-collection value stored on disk.

Orphan is suitable for storing simple data types like integers, enums, etc.

Implementations§

Source§

impl<T> Orphan<T>
where T: ValueEnDe,

Source

pub unsafe fn shadow(&self) -> Self

Creates a “shadow” copy of the Orphan instance.

§Safety

This API breaks Rust’s semantic safety guarantees. Use only in a race-free environment.

Source

pub unsafe fn from_bytes(s: impl AsRef<[u8]>) -> Self

Creates an Orphan from a byte slice.

§Safety

This function is unsafe and assumes the byte slice is a valid representation.

Source

pub fn as_bytes(&self) -> &[u8]

Returns the byte representation of the Orphan.

Source

pub fn new(v: T) -> Self

Creates a new Orphan with an initial value.

Source

pub fn get_value(&self) -> T

Retrieves a clone of the inner value.

Source

pub fn set_value(&mut self, v: &T)

Sets the inner value.

Source

pub fn is_uninitialized(&self) -> bool

Checks if the Orphan is uninitialized.

Source

pub fn initialize_if_empty(&mut self, v: T)

Initializes the Orphan with a value if it is currently empty.

Source

pub fn get_mut(&mut self) -> ValueMut<'_, T>

Retrieves a mutable handler for the value.

This is the recommended way to modify the value.

§Example
let mut o = Orphan::new(10);
*o.get_mut() = 20;
assert_eq!(o.get_value(), 20);
Source

pub fn is_the_same_instance(&self, other_hdr: &Self) -> bool

Checks if this Orphan instance is the same as another.

Trait Implementations§

Source§

impl<T> Add<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Add<Output = T>,

Source§

type Output = T

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for Orphan<T>
where T: ValueEnDe + Ord + Eq + Add<Output = T>,

Source§

type Output = T

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> AddAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + AddAssign,

Source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
Source§

impl<T> AddAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + AddAssign,

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T> BitAnd<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitAnd<Output = T>,

Source§

type Output = T

The resulting type after applying the & operator.
Source§

fn bitand(self, other: T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T> BitAnd for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitAnd<Output = T>,

Source§

type Output = T

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<T> BitAndAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitAndAssign,

Source§

fn bitand_assign(&mut self, other: T)

Performs the &= operation. Read more
Source§

impl<T> BitAndAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitAndAssign,

Source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
Source§

impl<T> BitOr<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitOr<Output = T>,

Source§

type Output = T

The resulting type after applying the | operator.
Source§

fn bitor(self, other: T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T> BitOr for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitOr<Output = T>,

Source§

type Output = T

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<T> BitOrAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitOrAssign,

Source§

fn bitor_assign(&mut self, other: T)

Performs the |= operation. Read more
Source§

impl<T> BitOrAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitOrAssign,

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl<T> BitXor<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitXor<Output = T>,

Source§

type Output = T

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T> BitXor for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitXor<Output = T>,

Source§

type Output = T

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T> BitXorAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitXorAssign,

Source§

fn bitxor_assign(&mut self, other: T)

Performs the ^= operation. Read more
Source§

impl<T> BitXorAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + BitXorAssign,

Source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
Source§

impl<T> Clone for Orphan<T>

Source§

fn clone(&self) -> Self

Returns a duplicate 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: Debug> Debug for Orphan<T>

Source§

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

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

impl<T: Default + ValueEnDe> Default for Orphan<T>

Source§

fn default() -> Self

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

impl<'de, T> Deserialize<'de> for Orphan<T>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Div<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Div<Output = T>,

Source§

type Output = T

The resulting type after applying the / operator.
Source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div for Orphan<T>
where T: ValueEnDe + Ord + Eq + Div<Output = T>,

Source§

type Output = T

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> DivAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + DivAssign,

Source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + DivAssign,

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<T> Mul<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Mul<Output = T>,

Source§

type Output = T

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for Orphan<T>
where T: ValueEnDe + Ord + Eq + Mul<Output = T>,

Source§

type Output = T

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + MulAssign,

Source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + MulAssign,

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T> Neg for Orphan<T>
where T: ValueEnDe + Ord + Eq + Neg<Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> Not for Orphan<T>
where T: ValueEnDe + Ord + Eq + Not<Output = T>,

Source§

type Output = T

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T> Ord for Orphan<T>
where T: ValueEnDe + Ord,

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) -> Self
where Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl<T> PartialEq<T> for Orphan<T>
where T: ValueEnDe + PartialEq,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialEq for Orphan<T>
where T: ValueEnDe + PartialEq,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialOrd<T> for Orphan<T>
where T: ValueEnDe + Ord,

Source§

fn partial_cmp(&self, other: &T) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> PartialOrd for Orphan<T>
where T: ValueEnDe + Ord,

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> Rem<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Rem<Output = T>,

Source§

type Output = T

The resulting type after applying the % operator.
Source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T> Rem for Orphan<T>
where T: ValueEnDe + Ord + Eq + Rem<Output = T>,

Source§

type Output = T

The resulting type after applying the % operator.
Source§

fn rem(self, other: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl<T> RemAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + RemAssign,

Source§

fn rem_assign(&mut self, other: T)

Performs the %= operation. Read more
Source§

impl<T> RemAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + RemAssign,

Source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
Source§

impl<T> Serialize for Orphan<T>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T> Shl<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Shl<Output = T>,

Source§

type Output = T

The resulting type after applying the << operator.
Source§

fn shl(self, other: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T> Shl for Orphan<T>
where T: ValueEnDe + Ord + Eq + Shl<Output = T>,

Source§

type Output = T

The resulting type after applying the << operator.
Source§

fn shl(self, other: Self) -> Self::Output

Performs the << operation. Read more
Source§

impl<T> ShlAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + ShlAssign,

Source§

fn shl_assign(&mut self, other: T)

Performs the <<= operation. Read more
Source§

impl<T> ShlAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + ShlAssign,

Source§

fn shl_assign(&mut self, other: Self)

Performs the <<= operation. Read more
Source§

impl<T> Shr<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Shr<Output = T>,

Source§

type Output = T

The resulting type after applying the >> operator.
Source§

fn shr(self, other: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T> Shr for Orphan<T>
where T: ValueEnDe + Ord + Eq + Shr<Output = T>,

Source§

type Output = T

The resulting type after applying the >> operator.
Source§

fn shr(self, other: Self) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T> ShrAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + ShrAssign,

Source§

fn shr_assign(&mut self, other: T)

Performs the >>= operation. Read more
Source§

impl<T> ShrAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + ShrAssign,

Source§

fn shr_assign(&mut self, other: Self)

Performs the >>= operation. Read more
Source§

impl<T> Sub<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + Sub<Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for Orphan<T>
where T: ValueEnDe + Ord + Eq + Sub<Output = T>,

Source§

type Output = T

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> SubAssign<T> for Orphan<T>
where T: ValueEnDe + Ord + Eq + SubAssign,

Source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
Source§

impl<T> SubAssign for Orphan<T>
where T: ValueEnDe + Ord + Eq + SubAssign,

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<T> Eq for Orphan<T>
where T: ValueEnDe + PartialEq,

Auto Trait Implementations§

§

impl<T> !Freeze for Orphan<T>

§

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

§

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

§

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

§

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

§

impl<T> UnsafeUnpin for Orphan<T>

§

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

Source§

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

Compare self to key and return their ordering.
Source§

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

Source§

fn equivalent(&self, key: &K) -> 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> KeyDe for T

Source§

fn decode_key(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a key from a byte slice.
Source§

impl<T> KeyEn for T
where T: Serialize,

Source§

fn try_encode_key(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the key into a byte vector.
Source§

fn encode_key(&self) -> RawBytes

Encodes the key into a byte vector, panicking on failure.
Source§

impl<T> KeyEnDe for T
where T: KeyEn + KeyDe,

Source§

fn try_encode(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the key into a byte vector.
Source§

fn encode(&self) -> Vec<u8>

Encodes the key into a byte vector, panicking on failure.
Source§

fn decode(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a key from a byte slice.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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> ValueDe for T

Source§

fn decode_value(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a value from a byte slice.
Source§

impl<T> ValueEn for T
where T: Serialize,

Source§

fn try_encode_value(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the value into a byte vector.
Source§

fn encode_value(&self) -> RawBytes

Encodes the value into a byte vector, panicking on failure.
Source§

impl<T> ValueEnDe for T
where T: ValueEn + ValueDe,

Source§

fn try_encode(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the value into a byte vector.
Source§

fn encode(&self) -> Vec<u8>

Encodes the value into a byte vector, panicking on failure.
Source§

fn decode(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a value from a byte slice.
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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,