Add conversion traits to Builder #12

Merged
cadey merged 3 commits from :to-string into main 2020-12-06 01:13:25 +00:00
1 changed files with 9 additions and 0 deletions
Showing only changes of commit a7fabdc909 - Show all commits

View File

@ -87,6 +87,15 @@ impl AsMut<[Node]> for Builder {
}
}
impl From<Builder> for Vec<Node> {
/// Convert into a collection of [`Node`]s.
///
/// Equivilent to calling [`Builder::build()`]
fn from(builder: Builder) -> Self {
builder.build()
}
}
/// Render a set of nodes as a document to a writer.
pub fn render(nodes: impl AsRef<[Node]>, out: &mut impl Write) -> io::Result<()> {
use Node::*;