From a7fabdc9098afba04f40cf5bb669f09d1ee37213 Mon Sep 17 00:00:00 2001 From: Emii Tatsuo Date: Mon, 30 Nov 2020 01:40:23 -0500 Subject: [PATCH] Allow Builder as Into> --- gemtext/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gemtext/src/lib.rs b/gemtext/src/lib.rs index f9cc830..8d532cd 100644 --- a/gemtext/src/lib.rs +++ b/gemtext/src/lib.rs @@ -87,6 +87,15 @@ impl AsMut<[Node]> for Builder { } } +impl From for Vec { + /// 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::*;