pub trait Render {
// Required method
fn render_to(&self, buffer: &mut String);
// Provided method
fn render(&self) -> String { ... }
}Expand description
The markup! macro will render interpolated content by wrapping it in this trait’s Render::render_to
function.
Implementing this trait for types will allow them them to be used directly in the markup! macro.
§Example
let markup = collage::markup! { (42) };
// Is equivalent to
let markup = {
extern crate alloc;
extern crate collage;
&|__collage_buffer: &mut alloc::string::String| {
__collage_buffer.reserve(4usize);
collage::Render::render_to(&42, __collage_buffer);
}
};