doku-derive 0.21.2

A framework for building documentation (internal macro)
Documentation
mod doc;
mod doku;
mod serde;
mod types;

pub use self::{doc::*, doku::*, serde::*, types::*};

use crate::prelude::*;
use darling::FromMeta;

fn from_ast<T>(
    attrs: &[syn::Attribute],
    name: &str,
) -> Result<impl Iterator<Item = T> + use<T>>
where
    T: FromMeta,
{
    let attrs: Vec<_> = attrs
        .iter()
        .filter(|attr| path_to_string(attr.path()) == name)
        .map(|attr| {
            let this = T::from_meta(&attr.meta)?;
            Ok(this)
        })
        .collect::<Result<_>>()?;

    Ok(attrs.into_iter())
}