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§
Sourcefn get_position(&self) -> Option<&Span>
fn get_position(&self) -> Option<&Span>
Returns position of node as span as it was parsed. May be invalid or none after mutation
fn from_reader( reader: &mut impl TokenReader<CSSToken, Span>, ) -> Result<Self, ParseError>
Sourcefn to_string_from_buffer(
&self,
buf: &mut impl ToString,
settings: &ToStringSettings,
depth: u8,
)
fn to_string_from_buffer( &self, buf: &mut impl ToString, settings: &ToStringSettings, depth: u8, )
Depth indicates the indentation of current block
Provided Methods§
Sourcefn from_string(
string: String,
source_id: SourceId,
offset: Option<usize>,
) -> Result<Self, ParseError>
fn from_string( string: String, source_id: SourceId, offset: Option<usize>, ) -> Result<Self, ParseError>
Parses structure from string
Sourcefn to_string(&self, settings: &ToStringSettings) -> String
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.