pub trait Callbacks {
// Required methods
fn extension(&self) -> &'static str;
fn generate_files(
&mut self,
generator: Generator<'_>,
) -> HashMap<String, String>;
fn encode(&mut self, s: &mut String, events: Vec<Event<'_>>);
// Provided methods
fn start_method(
&mut self,
_s: &mut String,
_resolver: &Resolver,
_method: &Method,
) { ... }
fn start_property(
&mut self,
_s: &mut String,
_resolver: &Resolver,
_property: &Property,
) { ... }
}
Expand description
Callbacks to encode markdown input in a given format.
This trait should be implemented if you want to make your own backend.
Required Methods§
Sourcefn generate_files(
&mut self,
generator: Generator<'_>,
) -> HashMap<String, String>
fn generate_files( &mut self, generator: Generator<'_>, ) -> HashMap<String, String>
Drive the generation process.
This returns a map from file names (relative to the output directory) to their contents.
You can find inspiration about how to implement this in the source code, for
example in src/backend/html.rs
.
Provided Methods§
Sourcefn start_method(
&mut self,
_s: &mut String,
_resolver: &Resolver,
_method: &Method,
)
fn start_method( &mut self, _s: &mut String, _resolver: &Resolver, _method: &Method, )
Called before encoding each method.
Default: does nothing
Sourcefn start_property(
&mut self,
_s: &mut String,
_resolver: &Resolver,
_property: &Property,
)
fn start_property( &mut self, _s: &mut String, _resolver: &Resolver, _property: &Property, )
Called before encoding each property.
Default: does nothing
Implementations§
Source§impl dyn Callbacks
impl dyn Callbacks
Sourcepub fn start_method_default(
&mut self,
s: &mut String,
property: &Resolver,
method: &Method,
)
pub fn start_method_default( &mut self, s: &mut String, property: &Resolver, method: &Method, )
Default start_method implementation, implemented on dyn Callbacks
to avoid
code duplication.
This will create a level 3 header that looks like (in markdown):
### <a id="func-name"></a>func name(arg1: [type](link), ...) -> [type](link)
________
With appropriate linking.
Sourcepub fn start_property_default(
&mut self,
s: &mut String,
resolver: &Resolver,
property: &Property,
)
pub fn start_property_default( &mut self, s: &mut String, resolver: &Resolver, property: &Property, )
Default start_property implementation, implemented on dyn Callbacks
to avoid
code duplication.
This will create a level 3 header that looks like (in markdown):
### <a id="property-name"></a> name: [type](link)
________
With appropriate linking.