Struct bbscope::ScopeInfo

source ·
pub struct ScopeInfo {
    pub only: Option<Vec<&'static str>>,
    pub double_closes: bool,
    pub emit: EmitScope,
}
Expand description

Information about a scoped tag with open and close elements. This gives you the power to craft many kinds of markup, not just bbcode, and have it understand scope

Fields§

§only: Option<Vec<&'static str>>

A list of MatchInfo ids for tags which are allowed to be parsed within the body of this scope. If None, any tag is allowed (default)

§double_closes: bool

Whether or not this scope automatically closes previous scopes of the same type. Generally this isn’t how tags work: doing [b][b][b]EXTRA BOLD[/b][/b][/b] produces triple bold text. However, elements like [*] (list item) benefit from closing the previous scope if it’s the same type

§emit: EmitScope

The core of the parsing system: your provided closure which transforms the pre-parsed data given into HTML (or whatever)

Trait Implementations§

Create a default scope info with an emitter that only outputs the body of the tags (you probably don’t want this!)

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 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.