Enum json5format::Comment[][src]

pub enum Comment {
    Block {
        lines: Vec<String>,
        align: bool,
    },
    Line(String),
    Break,
}

Represents the variations of allowable comments.

Variants

Block

Represents a comment read from a /* */ pattern.

Fields of Block

lines: Vec<String>

The content of the block comment, represented as a String for each line.

align: bool

align (if true) indicates that all comment lines started in a column after the star’s column in the opening /*. For each subsequent line in lines, the spaces from column 0 to the star’s column will be stripped, allowing the indent spaces to be restored, during format, relative to the block’s new horizontal position. Otherwise, the original indentation will not be stripped, and the lines will be restored at their original horizontal position. In either case, lines after the opening /* will retain their original horizontal alignment, relative to one another.

Line(String)

Represents a comment read from a line starting with //.

Break

Represents a blank line between data.

Implementations

impl Comment[src]

pub fn is_block(&self) -> bool[src]

Returns true if the Comment instance is a Block variant.

pub fn is_line(&self) -> bool[src]

Returns true if the Comment instance is a Line variant.

pub fn is_break(&self) -> bool[src]

Returns true if the Comment instance is a Break variant.

Trait Implementations

impl Clone for Comment[src]

impl Debug for Comment[src]

Auto Trait Implementations

impl RefUnwindSafe for Comment

impl Send for Comment

impl Sync for Comment

impl Unpin for Comment

impl UnwindSafe for Comment

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.