Allow Builder as Into<Vec<Node>>

This commit is contained in:
Emii Tatsuo 2020-11-30 01:40:23 -05:00
parent 2f3dd72d90
commit a7fabdc909
No known key found for this signature in database
GPG Key ID: 68FAB2E2E6DFC98B
1 changed files with 9 additions and 0 deletions

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::*;