Enum yrs::any::Any

source ·
pub enum Any {
    Null,
    Undefined,
    Bool(bool),
    Number(f64),
    BigInt(i64),
    String(Arc<str>),
    Buffer(Arc<[u8]>),
    Array(Arc<[Any]>),
    Map(Arc<HashMap<String, Any>>),
}
Expand description

Any is an enum with a potentially associated value that is used to represent JSON values and supports efficient encoding of those values.

Variants§

§

Null

§

Undefined

§

Bool(bool)

§

Number(f64)

§

BigInt(i64)

§

String(Arc<str>)

§

Buffer(Arc<[u8]>)

§

Array(Arc<[Any]>)

§

Map(Arc<HashMap<String, Any>>)

Implementations§

source§

impl Any

source

pub fn cast<T>(self) -> Result<T, Self>
where T: TryFrom<Any, Error = Any>,

source

pub fn decode<R: Read>(decoder: &mut R) -> Result<Self, Error>

source

pub fn encode<W: Write>(&self, encoder: &mut W)

source

pub fn from_json(src: &str) -> Result<Self, Error>

source

pub fn to_json(&self, buf: &mut String)

Trait Implementations§

source§

impl Clone for Any

source§

fn clone(&self) -> Any

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 Debug for Any

source§

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

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

impl<'de> Deserialize<'de> for Any

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 Display for Any

source§

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

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

impl From<&[u8]> for Any

source§

fn from(value: &[u8]) -> Self

Converts to this type from the input type.
source§

impl From<&str> for Any

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<Arc<[u8]>> for Any

source§

fn from(value: Arc<[u8]>) -> Self

Converts to this type from the input type.
source§

impl From<Arc<str>> for Any

source§

fn from(value: Arc<str>) -> Self

Converts to this type from the input type.
source§

impl<T> From<HashMap<String, T>> for Any
where T: Into<Any>,

source§

fn from(v: HashMap<String, T>) -> Any

Converts to this type from the input type.
source§

impl<T> From<Option<T>> for Any
where T: Into<Any>,

source§

fn from(v: Option<T>) -> Any

Converts to this type from the input type.
source§

impl From<String> for Any

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vec<T>> for Any
where T: Into<Any>,

source§

fn from(v: Vec<T>) -> Any

Converts to this type from the input type.
source§

impl From<Vec<u8>> for Any

source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Any

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Any

source§

fn from(v: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Any

source§

fn from(v: f64) -> Self

Converts to this type from the input type.
source§

impl From<i16> for Any

source§

fn from(v: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Any

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Any

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl From<isize> for Any

source§

fn from(value: isize) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Any

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Any

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Any

source§

fn eq(&self, other: &Any) -> 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 Serialize for Any

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 TryFrom<Any> for Arc<[u8]>

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for Arc<str>

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for String

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for Vec<u8>

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for bool

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for f32

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for f64

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for i16

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for i32

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for i64

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for isize

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for u16

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for u32

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for u64

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Any> for usize

§

type Error = Any

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

fn try_from(v: Any) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<ItemPtr> for Any

§

type Error = ItemPtr

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

fn try_from(item: ItemPtr) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<u64> for Any

§

type Error = u64

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

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<usize> for Any

§

type Error = usize

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

fn try_from(value: usize) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl StructuralPartialEq for Any

Auto Trait Implementations§

§

impl Freeze for Any

§

impl RefUnwindSafe for Any

§

impl Send for Any

§

impl Sync for Any

§

impl Unpin for Any

§

impl UnwindSafe for Any

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> 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> Prelim for T
where T: Into<Any>,

§

type Return = Unused

Type of a value to be returned as a result of inserting this Prelim type instance. Use Unused if none is necessary.
source§

fn into_content(self, _txn: &mut TransactionMut<'_>) -> (ItemContent, Option<T>)

This method is used to create initial content required in order to create a block item. A supplied ptr can be used to identify block that is about to be created to store the returned content. Read more
source§

fn integrate(self, _txn: &mut TransactionMut<'_>, _inner_ref: BranchPtr)

Method called once an original item filled with content from Self::into_content has been added to block store. This method is used by complex types such as maps or arrays to append the original contents of prelim struct into YMap, YArray etc.
source§

impl<T> ToOwned for T
where 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,