Enum ezno_parser::ast::WithComment
source · pub enum WithComment<T> {
None(T),
PrefixComment(String, T),
PostfixComment(T, String),
}
Variants§
Implementations§
source§impl<T> WithComment<T>
impl<T> WithComment<T>
pub fn get_ast(&self) -> &T
pub fn get_ast_mut(&mut self) -> &mut T
pub fn add_comment(&mut self, comment: &str)
pub fn unwrap_ast(self) -> T
pub fn as_ref_mut(&mut self) -> WithComment<&mut T>
pub fn map<U>(self, cb: impl FnOnce(T) -> U) -> WithComment<U>
Trait Implementations§
source§impl<T: ASTNode> ASTNode for WithComment<T>
impl<T: ASTNode> ASTNode for WithComment<T>
fn from_reader( reader: &mut impl TokenReader<TSXToken, Span>, state: &mut ParsingState, settings: &ParseSettings ) -> Result<WithComment<T>, ParseError>
source§fn get_position(&self) -> Cow<'_, Span>
fn get_position(&self) -> Cow<'_, Span>
Returns position of node as span AS IT WAS PARSED. May be none if AST was doesn’t match anything in source
fn to_string_from_buffer<U: ToString>( &self, buf: &mut U, settings: &ToStringSettingsAndData, depth: u8 )
source§fn from_string(
source: String,
settings: ParseSettings,
source_id: SourceId,
offset: Option<usize>,
cursors: Vec<(usize, EmptyCursorId)>
) -> ParseResult<ParseOutput<Self>>
fn from_string( source: String, settings: ParseSettings, source_id: SourceId, offset: Option<usize>, cursors: Vec<(usize, EmptyCursorId)> ) -> ParseResult<ParseOutput<Self>>
From string, with default impl to call abstract method from_reader
source§fn to_string(&self, settings: &ToStringSettingsAndData) -> String
fn to_string(&self, settings: &ToStringSettingsAndData) -> String
Returns structure as valid string
source§impl<T: Clone> Clone for WithComment<T>
impl<T: Clone> Clone for WithComment<T>
source§fn clone(&self) -> WithComment<T>
fn clone(&self) -> WithComment<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for WithComment<T>
impl<T: Debug> Debug for WithComment<T>
source§impl<T> From<T> for WithComment<T>
impl<T> From<T> for WithComment<T>
source§impl<T: PartialEq> PartialEq<WithComment<T>> for WithComment<T>
impl<T: PartialEq> PartialEq<WithComment<T>> for WithComment<T>
source§impl<T> SelfRustTokenize for WithComment<T>where
T: SelfRustTokenize,
impl<T> SelfRustTokenize for WithComment<T>where T: SelfRustTokenize,
fn append_to_token_stream(&self, token_stream: &mut TokenStream)
source§fn to_tokens(&self) -> TokenStream
fn to_tokens(&self) -> TokenStream
Returns the tokens used to construct self
source§impl Visitable for WithComment<VariableField<VariableFieldInSourceCode>>
impl Visitable for WithComment<VariableField<VariableFieldInSourceCode>>
For object literals and things with computable or literal keys