use crate::{presentable::HeadingLevel, Presentable};
#[async_trait::async_trait(?Send)]
pub trait Presenter<'output> {
async fn heading<P>(&mut self, level: HeadingLevel, presentable: &P) -> Result<(), Self::Error>
where
P: Presentable + ?Sized;
type Error: std::error::Error;
async fn id(&mut self, id: &str) -> Result<(), Self::Error>;
async fn name(&mut self, name: &str) -> Result<(), Self::Error>;
async fn text(&mut self, text: &str) -> Result<(), Self::Error>;
async fn bold<P>(&mut self, presentable: &P) -> Result<(), Self::Error>
where
P: Presentable + ?Sized;
async fn code_inline(&mut self, text: &str) -> Result<(), Self::Error>;
async fn tag(&mut self, tag: &str) -> Result<(), Self::Error>;
async fn list_numbered<'f, P, I>(&mut self, iter: I) -> Result<(), Self::Error>
where
P: Presentable + ?Sized + 'f,
I: IntoIterator<Item = &'f P>;
async fn list_numbered_with<'f, P, I, T, F>(
&mut self,
iter: I,
f: F,
) -> Result<(), Self::Error>
where
P: Presentable,
I: IntoIterator<Item = T>,
T: 'f,
F: Fn(T) -> P;
async fn list_numbered_aligned<'f, P0, P1, I>(&mut self, iter: I) -> Result<(), Self::Error>
where
P0: Presentable + 'f,
P1: Presentable + 'f,
I: IntoIterator<Item = &'f (P0, P1)>;
async fn list_numbered_aligned_with<'f, P0, P1, I, T, F>(
&mut self,
iter: I,
f: F,
) -> Result<(), Self::Error>
where
P0: Presentable + 'f,
P1: Presentable + 'f,
I: IntoIterator<Item = T>,
T: 'f,
F: Fn(T) -> &'f (P0, P1);
async fn list_bulleted<'f, P, I>(&mut self, iter: I) -> Result<(), Self::Error>
where
P: Presentable + ?Sized + 'f,
I: IntoIterator<Item = &'f P>;
async fn list_bulleted_with<'f, P, I, T, F>(
&mut self,
iter: I,
f: F,
) -> Result<(), Self::Error>
where
P: Presentable,
I: IntoIterator<Item = T>,
T: 'f,
F: Fn(T) -> P;
async fn list_bulleted_aligned<'f, P0, P1, I>(&mut self, iter: I) -> Result<(), Self::Error>
where
P0: Presentable + 'f,
P1: Presentable + 'f,
I: IntoIterator<Item = &'f (P0, P1)>;
async fn list_bulleted_aligned_with<'f, P0, P1, I, T, F>(
&mut self,
iter: I,
f: F,
) -> Result<(), Self::Error>
where
P0: Presentable + 'f,
P1: Presentable + 'f,
I: IntoIterator<Item = T>,
T: 'f,
F: Fn(T) -> &'f (P0, P1);
}