Running into borrow issue on intermediate.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::macros::iitem;
|
||||
|
||||
use super::angle_link::IAngleLink;
|
||||
use super::bold::IBold;
|
||||
@@ -62,88 +63,124 @@ pub(crate) enum IObject {
|
||||
Timestamp(ITimestamp),
|
||||
}
|
||||
|
||||
iselector!(IObject, Object, |registry, obj| async {
|
||||
match &obj {
|
||||
organic::types::Object::Bold(inner) => {
|
||||
Ok(IObject::Bold(IBold::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::Italic(inner) => {
|
||||
Ok(IObject::Italic(IItalic::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::Underline(inner) => {
|
||||
Ok(IObject::Underline(IUnderline::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::StrikeThrough(inner) => Ok(IObject::StrikeThrough(
|
||||
IStrikeThrough::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::Code(inner) => {
|
||||
Ok(IObject::Code(ICode::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::Verbatim(inner) => {
|
||||
Ok(IObject::Verbatim(IVerbatim::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::PlainText(inner) => {
|
||||
Ok(IObject::PlainText(IPlainText::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::RegularLink(inner) => Ok(IObject::RegularLink(
|
||||
IRegularLink::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::RadioLink(inner) => {
|
||||
Ok(IObject::RadioLink(IRadioLink::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::RadioTarget(inner) => Ok(IObject::RadioTarget(
|
||||
IRadioTarget::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::PlainLink(inner) => {
|
||||
Ok(IObject::PlainLink(IPlainLink::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::AngleLink(inner) => {
|
||||
Ok(IObject::AngleLink(IAngleLink::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::OrgMacro(inner) => {
|
||||
Ok(IObject::OrgMacro(IOrgMacro::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::Entity(inner) => {
|
||||
Ok(IObject::Entity(IEntity::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::LatexFragment(inner) => Ok(IObject::LatexFragment(
|
||||
ILatexFragment::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::ExportSnippet(inner) => Ok(IObject::ExportSnippet(
|
||||
IExportSnippet::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::FootnoteReference(inner) => Ok(IObject::FootnoteReference(
|
||||
IFootnoteReference::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::Citation(inner) => {
|
||||
Ok(IObject::Citation(ICitation::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::CitationReference(inner) => Ok(IObject::CitationReference(
|
||||
ICitationReference::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::InlineBabelCall(inner) => Ok(IObject::InlineBabelCall(
|
||||
IInlineBabelCall::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::InlineSourceBlock(inner) => Ok(IObject::InlineSourceBlock(
|
||||
IInlineSourceBlock::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::LineBreak(inner) => {
|
||||
Ok(IObject::LineBreak(ILineBreak::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::Target(inner) => {
|
||||
Ok(IObject::Target(ITarget::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::StatisticsCookie(inner) => Ok(IObject::StatisticsCookie(
|
||||
IStatisticsCookie::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::Subscript(inner) => {
|
||||
Ok(IObject::Subscript(ISubscript::new(registry, inner).await?))
|
||||
}
|
||||
organic::types::Object::Superscript(inner) => Ok(IObject::Superscript(
|
||||
ISuperscript::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::Object::Timestamp(inner) => {
|
||||
Ok(IObject::Timestamp(ITimestamp::new(registry, inner).await?))
|
||||
}
|
||||
}
|
||||
iselector!(IObject, Object, |registry, original| async {
|
||||
iitem!(
|
||||
registry,
|
||||
original,
|
||||
(organic::types::Object::Bold, IObject::Bold, IBold),
|
||||
(organic::types::Object::Italic, IObject::Italic, IItalic),
|
||||
(
|
||||
organic::types::Object::Underline,
|
||||
IObject::Underline,
|
||||
IUnderline
|
||||
),
|
||||
(
|
||||
organic::types::Object::StrikeThrough,
|
||||
IObject::StrikeThrough,
|
||||
IStrikeThrough
|
||||
),
|
||||
(organic::types::Object::Code, IObject::Code, ICode),
|
||||
(
|
||||
organic::types::Object::Verbatim,
|
||||
IObject::Verbatim,
|
||||
IVerbatim
|
||||
),
|
||||
(
|
||||
organic::types::Object::PlainText,
|
||||
IObject::PlainText,
|
||||
IPlainText
|
||||
),
|
||||
(
|
||||
organic::types::Object::RegularLink,
|
||||
IObject::RegularLink,
|
||||
IRegularLink
|
||||
),
|
||||
(
|
||||
organic::types::Object::RadioLink,
|
||||
IObject::RadioLink,
|
||||
IRadioLink
|
||||
),
|
||||
(
|
||||
organic::types::Object::RadioTarget,
|
||||
IObject::RadioTarget,
|
||||
IRadioTarget
|
||||
),
|
||||
(
|
||||
organic::types::Object::PlainLink,
|
||||
IObject::PlainLink,
|
||||
IPlainLink
|
||||
),
|
||||
(
|
||||
organic::types::Object::AngleLink,
|
||||
IObject::AngleLink,
|
||||
IAngleLink
|
||||
),
|
||||
(
|
||||
organic::types::Object::OrgMacro,
|
||||
IObject::OrgMacro,
|
||||
IOrgMacro
|
||||
),
|
||||
(organic::types::Object::Entity, IObject::Entity, IEntity),
|
||||
(
|
||||
organic::types::Object::LatexFragment,
|
||||
IObject::LatexFragment,
|
||||
ILatexFragment
|
||||
),
|
||||
(
|
||||
organic::types::Object::ExportSnippet,
|
||||
IObject::ExportSnippet,
|
||||
IExportSnippet
|
||||
),
|
||||
(
|
||||
organic::types::Object::FootnoteReference,
|
||||
IObject::FootnoteReference,
|
||||
IFootnoteReference
|
||||
),
|
||||
(
|
||||
organic::types::Object::Citation,
|
||||
IObject::Citation,
|
||||
ICitation
|
||||
),
|
||||
(
|
||||
organic::types::Object::CitationReference,
|
||||
IObject::CitationReference,
|
||||
ICitationReference
|
||||
),
|
||||
(
|
||||
organic::types::Object::InlineBabelCall,
|
||||
IObject::InlineBabelCall,
|
||||
IInlineBabelCall
|
||||
),
|
||||
(
|
||||
organic::types::Object::InlineSourceBlock,
|
||||
IObject::InlineSourceBlock,
|
||||
IInlineSourceBlock
|
||||
),
|
||||
(
|
||||
organic::types::Object::LineBreak,
|
||||
IObject::LineBreak,
|
||||
ILineBreak
|
||||
),
|
||||
(organic::types::Object::Target, IObject::Target, ITarget),
|
||||
(
|
||||
organic::types::Object::StatisticsCookie,
|
||||
IObject::StatisticsCookie,
|
||||
IStatisticsCookie
|
||||
),
|
||||
(
|
||||
organic::types::Object::Subscript,
|
||||
IObject::Subscript,
|
||||
ISubscript
|
||||
),
|
||||
(
|
||||
organic::types::Object::Superscript,
|
||||
IObject::Superscript,
|
||||
ISuperscript
|
||||
),
|
||||
(
|
||||
organic::types::Object::Timestamp,
|
||||
IObject::Timestamp,
|
||||
ITimestamp
|
||||
),
|
||||
)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user