pub enum Item<N: Node> {
Node(N),
Function,
Value(Rc<Value>),
}
Expand description
Variants§
Node(N)
A Node in the source document.
Function
Functions are not yet supported
Value(Rc<Value>)
A scalar value. These are in an Rc since they are frequently shared.
Implementations§
Source§impl<N: Node> Item<N>
impl<N: Node> Item<N>
Sourcepub fn to_xml_with_options(&self, od: &OutputDefinition) -> String
pub fn to_xml_with_options(&self, od: &OutputDefinition) -> String
Serialize as XML, with options
Sourcepub fn to_bool(&self) -> bool
pub fn to_bool(&self) -> bool
Determine the effective boolean value of the item. See XPath 2.4.3.
Sourcepub fn to_double(&self) -> f64
pub fn to_double(&self) -> f64
Gives the double value of the item. Returns NaN if the value cannot be converted to a double.
Sourcepub fn name(&self) -> Rc<QualifiedName>
pub fn name(&self) -> Rc<QualifiedName>
Gives the name of the item. Certain types of Nodes have names, such as element-type nodes. If the item does not have a name returns an empty string.
Sourcepub fn is_element_node(&self) -> bool
pub fn is_element_node(&self) -> bool
Is this item an element-type node?
Sourcepub fn add_attribute(&self, a: N) -> Result<(), Error>
pub fn add_attribute(&self, a: N) -> Result<(), Error>
Convenience method to set an attribute for a Node-type item. If the item is not an element-type node, then this method has no effect.
Sourcepub fn shallow_copy(&self) -> Result<Self, Error>
pub fn shallow_copy(&self) -> Result<Self, Error>
Make a shallow copy of an item. That is, the item is duplicated but not it’s content, including attributes.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for Item<N>where
N: Freeze,
impl<N> RefUnwindSafe for Item<N>where
N: RefUnwindSafe,
impl<N> !Send for Item<N>
impl<N> !Sync for Item<N>
impl<N> Unpin for Item<N>where
N: Unpin,
impl<N> UnwindSafe for Item<N>where
N: UnwindSafe,
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