Struct termimad::FmtComposite

source ·
pub struct FmtComposite<'s> {
    pub composite: Composite<'s>,
    pub visible_length: usize,
    pub spacing: Option<Spacing>,
}
Expand description

Wrap a Minimad Composite, which is a list of Compounds (which are strings with an homogeneous style)

Fields§

§composite: Composite<'s>§visible_length: usize§spacing: Option<Spacing>

Implementations§

Return the number of characters (usually spaces) to insert both sides of the composite

Add a compound and modifies visible_length accordingly

Ensure the cached visible_length is correct.

It’s normally not necessary to call it, but this must be called if compounds are added, removed or modified without using the FmtComposite API

try to ensure the composite’s width doesn’t exceed the given width.

The alignment can be used, if necessary, to know which side it’s better to remove content (for example if the alignment is left then we remove at right). The fitter may remove a part in the core of the composite if it looks good enough. In this specific case an ellipsis will replace the removed part.

if the composite is smaller than the given width, pad it according to the alignment.

try to make it so that the composite has exactly the given width, either by shortening it or by adding space.

This calls the fit_width and extend_width methods.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.