pub trait NumberWriter: Send + Sync {
// Required methods
fn name(&self) -> &Name;
fn compile(
&self,
cx: &WriterCx<'_>,
) -> Result<Arc<dyn CompiledNumberWriter>, StyleError>;
}Expand description
A number writer as a feature declares it: its name, and how it compiles itself once the language is built.
A feature contributes a writer, wrapped in a NumberWriterDecl, to the
service slot NUMBER_WRITERS_SLOT, and a
counter style asks for it by name with
CounterStyleDecl::with_number_writer.
Two writers of one name fail the registry build, and so does a counter
style that asks for a writer no feature registers. The numbering module
documentation describes what a writer receives
and writes.
Required Methods§
Sourcefn name(&self) -> &Name
fn name(&self) -> &Name
Returns the name by which counter styles ask for this writer. It is
dotted and owned by the feature that declares it, such as
example.numbering.in-section, as a counter style’s name is.
Sourcefn compile(
&self,
cx: &WriterCx<'_>,
) -> Result<Arc<dyn CompiledNumberWriter>, StyleError>
fn compile( &self, cx: &WriterCx<'_>, ) -> Result<Arc<dyn CompiledNumberWriter>, StyleError>
Returns this writer compiled against the built language, which cx
holds; every text of the writer’s own is parsed here. The library
compiles a writer once per counter style that asks for it, when the
registry is built.
§Errors
The StyleError of a text of the writer’s own that is not valid FLM.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".