use super::macros::iselector; use super::registry::Registry; use super::IHeading; use super::ISection; use crate::error::CustomError; use futures::future::{BoxFuture, FutureExt}; #[derive(Debug, Clone)] pub(crate) enum IDocumentElement { Heading(IHeading), Section(ISection), } iselector!( IDocumentElement, DocumentElement, |registry, original| async { match &original { organic::types::DocumentElement::Heading(inner) => Ok(IDocumentElement::Heading( IHeading::new(registry, inner).await?, )), organic::types::DocumentElement::Section(inner) => Ok(IDocumentElement::Section( ISection::new(registry, inner).await?, )), } } );