Struct ywasm::YXmlElement [−][src]
pub struct YXmlElement(_);
Expand description
XML element data type. It represents an XML node, which can contain key-value attributes
(interpreted as strings) as well as other nested XML elements or rich text (represented by
YXmlText
type).
In terms of conflict resolution, YXmlElement
uses following rules:
- Attribute updates use logical last-write-wins principle, meaning the past updates are automatically overridden and discarded by newer ones, while concurrent updates made by different peers are resolved into a single value using document id seniority to establish an order.
- Child node insertion uses sequencing rules from other Yrs collections - elements are inserted using interleave-resistant algorithm, where order of concurrent inserts at the same index is established using peer’s document id seniority.
Implementations
Returns a number of child XML nodes stored within this YXMlElement
instance.
pub fn insert_xml_element(
&self,
txn: &mut YTransaction,
index: u32,
name: &str
) -> YXmlElement
pub fn insert_xml_element(
&self,
txn: &mut YTransaction,
index: u32,
name: &str
) -> YXmlElement
Inserts a new instance of YXmlElement
as a child of this XML node and returns it.
Inserts a new instance of YXmlText
as a child of this XML node and returns it.
Removes a range of children XML nodes from this YXmlElement
instance,
starting at given index
.
Appends a new instance of YXmlElement
as the last child of this XML node and returns it.
Appends a new instance of YXmlText
as the last child of this XML node and returns it.
Returns a first child of this XML node.
It can be either YXmlElement
, YXmlText
or undefined
if current node has not children.
Returns a next XML sibling node of this XMl node.
It can be either YXmlElement
, YXmlText
or undefined
if current node is a last child of
parent XML node.
Returns a previous XML sibling node of this XMl node.
It can be either YXmlElement
, YXmlText
or undefined
if current node is a first child
of parent XML node.
Returns a parent YXmlElement
node or undefined
if current node has no parent assigned.
Returns a string representation of this XML node.
Sets a name
and value
as new attribute for this XML node. If an attribute with the same
name
already existed on that node, its value with be overridden with a provided one.
Returns a value of an attribute given its name
. If no attribute with such name existed,
null
will be returned.
Removes an attribute from this XML node, given its name
.
Returns an iterator that enables to traverse over all attributes of this XML node in unspecified order.
Returns an iterator that enables a deep traversal of this XML node - starting from first child over this XML node successors using depth-first strategy.
Trait Implementations
Performs the conversion.
type Anchor = Ref<'static, YXmlElement>
type Anchor = Ref<'static, YXmlElement>
The type that holds the reference to Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read more
Recover a Self::Anchor
from Self::Abi
. Read more
type Anchor = RefMut<'static, YXmlElement>
type Anchor = RefMut<'static, YXmlElement>
Same as RefFromWasmAbi::Anchor
Same as RefFromWasmAbi::ref_from_abi