pub enum Node<'s> {
Element(Element<'s>),
Text(Cow<'s, str>),
Comment(Cow<'s, str>),
}
Variants§
Implementations§
Source§impl<'s> Node<'s>
impl<'s> Node<'s>
Sourcepub fn new_comment(comment: &'s str) -> Self
pub fn new_comment(comment: &'s str) -> Self
Create a new comment node
Sourcepub fn parse_json(json: &'s str) -> Result<Self>
pub fn parse_json(json: &'s str) -> Result<Self>
Create the node from a json string
Sourcepub fn to_json_pretty(&self) -> Result<String>
pub fn to_json_pretty(&self) -> Result<String>
Output the node as a pretty json formatted string
pub fn fmt_opt<W>(
&self,
f: &mut W,
o: &FormattingOptions,
depth: usize,
) -> Resultwhere
W: Write,
Trait Implementations§
Source§impl<'de: 's, 's> Deserialize<'de> for Node<'s>
impl<'de: 's, 's> Deserialize<'de> for Node<'s>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<'a> IntoIterator for &'a Node<'a>
impl<'a> IntoIterator for &'a Node<'a>
impl<'s> StructuralPartialEq for Node<'s>
Auto Trait Implementations§
impl<'s> Freeze for Node<'s>
impl<'s> RefUnwindSafe for Node<'s>
impl<'s> Send for Node<'s>
impl<'s> Sync for Node<'s>
impl<'s> Unpin for Node<'s>
impl<'s> UnwindSafe for Node<'s>
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