Enum libpasta::primitives::Sod [] [src]

pub enum Sod<T: ?Sized + 'static> {
    Static(&'static T),
    Dynamic(Arc<Box<T>>),
}

Enum to hold either static references or reference-counted owned objects. Implements Deref to T for ease of use. Since internal data is either a static reference, or an Arc, cloning is a cheap operation.

Variants

Static reference to T

Dynamically allocated T, on the heap, atomically reference-counted.

Trait Implementations

impl<T: PartialEq + ?Sized + 'static> PartialEq for Sod<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: PartialOrd + ?Sized + 'static> PartialOrd for Sod<T>
[src]

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

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

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

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

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

impl<T: ?Sized> Deref for Sod<T>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<T: ?Sized> Clone for Sod<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more