Struct roff::Roff[][src]

pub struct Roff { /* fields omitted */ }
Expand description

A ROFF document, consisting of lines.

Lines are either control lines (requests that are built in, or invocations of macros), or text lines.

Example

let doc = Roff::new()
    .control("TH", ["FOO", "1"])
    .control("SH", ["NAME"])
    .text([roman("foo - do a foo thing")])
    .render();
assert!(doc.ends_with(".TH FOO 1\n.SH NAME\nfoo \\- do a foo thing\n"));

Implementations

Instantiate a Roff

Append a control line.

The line consist of the name of a built-in command or macro, and some number of arguments. Arguments that contain spaces will be enclosed with double quotation marks.

Append a text line.

The line will be rendered in a way that ensures it can’t be interpreted as a control line. The caller does not need to ensure, for example, that the line doesn’t start with a period (“.”) or an apostrophe (“'”).

Render as ROFF source text that can be fed to a ROFF implementation.

Write to a writer.

Render without handling apostrophes specially.

You probably want render or to_writer instead of this method.

Without special handling, apostrophes get typeset as right single quotes, including in words like “don’t”. In most situations, such as in manual pages, that’s unwanted. The other methods handle apostrophes specially to prevent it, but for completeness, and for testing, this method is provided to avoid it.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Performs the conversion.

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.