pub trait ReqHandler: Send + Sync {
// Required methods
fn start<'a>(
&'a self,
req: &'a ReqDefinition,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>;
fn end<'a>(
&'a self,
req: &'a ReqDefinition,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>;
}Expand description
A handler for rendering req definitions.
Reqs are rendered with opening and closing HTML, allowing the req content (paragraphs, code blocks, etc.) to be rendered in between.
Required Methods§
Sourcefn start<'a>(
&'a self,
req: &'a ReqDefinition,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
fn start<'a>( &'a self, req: &'a ReqDefinition, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
Render the opening HTML for a req definition.
This is called when a req is first detected. The returned HTML should contain the opening tags that will wrap the req content.
§Returns
The opening HTML string (e.g., <div class="req" id="r-my.req">).
Sourcefn end<'a>(
&'a self,
req: &'a ReqDefinition,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
fn end<'a>( &'a self, req: &'a ReqDefinition, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>
Render the closing HTML for a req definition.
This is called when the req content is finished. The returned HTML
should close any tags opened by start.
§Returns
The closing HTML string (e.g., </div>).