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 PartialEq for Value
impl PartialEq for Value
source§impl ToJson for Value
impl ToJson for Value
source§fn to_json<T: ReadTxn>(&self, txn: &T) -> Any
fn to_json<T: ReadTxn>(&self, txn: &T) -> Any
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