Stuck some more documentation on gemtext -> body conversion methods
This commit is contained in:
parent
367cc17e8f
commit
ffc86af284
|
@ -72,6 +72,9 @@ impl Body {
|
||||||
#[cfg(feature = "gemtext")]
|
#[cfg(feature = "gemtext")]
|
||||||
#[allow(clippy::fallible_impl_from)] // It's really not fallible but thanks
|
#[allow(clippy::fallible_impl_from)] // It's really not fallible but thanks
|
||||||
impl From<Vec<gemtext::Node>> for Body {
|
impl From<Vec<gemtext::Node>> for Body {
|
||||||
|
/// Render a series of [`gemtext`] nodes to a `text/gemini` body without [normalizing]
|
||||||
|
///
|
||||||
|
/// [normalizing]: Gemtext::normalize
|
||||||
fn from(document: Vec<gemtext::Node>) -> Self {
|
fn from(document: Vec<gemtext::Node>) -> Self {
|
||||||
let size: usize = document.iter().map(gemtext::Node::estimate_len).sum();
|
let size: usize = document.iter().map(gemtext::Node::estimate_len).sum();
|
||||||
let mut bytes = Vec::with_capacity(size + document.len());
|
let mut bytes = Vec::with_capacity(size + document.len());
|
||||||
|
@ -82,6 +85,9 @@ impl From<Vec<gemtext::Node>> for Body {
|
||||||
|
|
||||||
#[cfg(feature = "gemtext")]
|
#[cfg(feature = "gemtext")]
|
||||||
impl From<Gemtext> for Body {
|
impl From<Gemtext> for Body {
|
||||||
|
/// [Normalize][1] & eender a series of [`gemtext`] nodes to a `text/gemini` body
|
||||||
|
///
|
||||||
|
/// [1]: Gemtext::normalize
|
||||||
fn from(document: Gemtext) -> Self {
|
fn from(document: Gemtext) -> Self {
|
||||||
document.normalize().build().into()
|
document.normalize().build().into()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue