pub enum Value {
Any(Any),
YText(TextRef),
YArray(ArrayRef),
YMap(MapRef),
YXmlElement(XmlElementRef),
YXmlFragment(XmlFragmentRef),
YXmlText(XmlTextRef),
YDoc(Doc),
UndefinedRef(BranchPtr),
}Expand description
Value that can be returned by Yrs data types. This includes Any which is an extension representation of JSON, but also nested complex collaborative structures specific to Yrs.
Variants§
Any(Any)
Any value that it treated as a single element in it’s entirety.
YText(TextRef)
Instance of a TextRef.
YArray(ArrayRef)
Instance of an ArrayRef.
YMap(MapRef)
Instance of a MapRef.
YXmlElement(XmlElementRef)
Instance of a XmlElementRef.
YXmlFragment(XmlFragmentRef)
Instance of a XmlFragmentRef.
YXmlText(XmlTextRef)
Instance of a XmlTextRef.
YDoc(Doc)
Subdocument.
UndefinedRef(BranchPtr)
Instance of a shared collection of undefined type. Usually happens when it refers to a root type that has not been defined locally. Can also refer to a [WeakRef] if “weak” feature flag was not set.
Implementations§
Trait Implementations§
Source§impl ToJson for Value
impl ToJson for Value
Source§fn to_json<T>(&self, txn: &T) -> Anywhere
T: ReadTxn,
fn to_json<T>(&self, txn: &T) -> Anywhere
T: ReadTxn,
Converts current value into Any object equivalent that resembles enhanced JSON payload. Rules are:
- Primitive types (Value::Any) are passed right away, as no transformation is needed.
- Value::YArray is converted into JSON-like array.
- Value::YMap is converted into JSON-like object map.
- Value::YText, Value::YXmlText and Value::YXmlElement are converted into strings (XML types are stringified XML representation).
Source§impl TryFrom<Value> for XmlElementRef
impl TryFrom<Value> for XmlElementRef
Source§impl TryFrom<Value> for XmlFragmentRef
impl TryFrom<Value> for XmlFragmentRef
Source§impl TryFrom<Value> for XmlTextRef
impl TryFrom<Value> for XmlTextRef
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl !UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.