Trait ASTNode

Source
pub trait ASTNode:
    Sized
    + Send
    + Sync
    + 'static {
    // Required methods
    fn get_position(&self) -> Option<&Span>;
    fn from_reader(
        reader: &mut impl TokenReader<CSSToken, Span>,
    ) -> Result<Self, ParseError>;
    fn to_string_from_buffer(
        &self,
        buf: &mut impl ToString,
        settings: &ToStringSettings,
        depth: u8,
    );

    // Provided methods
    fn from_string(
        string: String,
        source_id: SourceId,
        offset: Option<usize>,
    ) -> Result<Self, ParseError> { ... }
    fn to_string(&self, settings: &ToStringSettings) -> String { ... }
}

Required Methods§

Source

fn get_position(&self) -> Option<&Span>

Returns position of node as span as it was parsed. May be invalid or none after mutation

Source

fn from_reader( reader: &mut impl TokenReader<CSSToken, Span>, ) -> Result<Self, ParseError>

Source

fn to_string_from_buffer( &self, buf: &mut impl ToString, settings: &ToStringSettings, depth: u8, )

Depth indicates the indentation of current block

Provided Methods§

Source

fn from_string( string: String, source_id: SourceId, offset: Option<usize>, ) -> Result<Self, ParseError>

Parses structure from string

Source

fn to_string(&self, settings: &ToStringSettings) -> String

Returns structure as valid string. If SourceMap passed will add mappings to SourceMap

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§