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§

source§

impl Default for ScopeInfo

source§

fn default() -> Self

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.