pub struct Noop;Expand description
A no-op visitor that ignores all callbacks.
Use when you only need to drive the parser (e.g. to validate syntax or consume input) without building any structure or collecting diagnostics.
§Example
use gcode::core::{parse, Noop};
let src = "G90 G01 X5 Y10";
parse(src, &mut Noop);Trait Implementations§
Source§impl BlockVisitor for Noop
impl BlockVisitor for Noop
Source§fn line_number(&mut self, n: u32, span: Span)
fn line_number(&mut self, n: u32, span: Span)
Optional N line number (e.g.
N100). Called at most once per block.Source§fn comment(&mut self, value: &str, span: Span)
fn comment(&mut self, value: &str, span: Span)
Comment content (excluding parentheses). Called for each comment on the line.
Source§fn program_number(&mut self, number: u32, span: Span)
fn program_number(&mut self, number: u32, span: Span)
Optional O program number (e.g.
O0001). Called at most once per block.Source§fn program_delimiter(&mut self, _span: Span)
fn program_delimiter(&mut self, _span: Span)
Program delimiter
% (RS-274 / ISO 6983). Called once per % token.Source§fn word_address(&mut self, _letter: char, _value: Value<'_>, _span: Span)
fn word_address(&mut self, _letter: char, _value: Value<'_>, _span: Span)
Modal bare word address (e.g.
X5.0, S12000 at block level without a G/M/T prefix).Source§fn start_general_code(
&mut self,
number: Number,
) -> ControlFlow<impl CommandVisitor + '_>
fn start_general_code( &mut self, number: Number, ) -> ControlFlow<impl CommandVisitor + '_>
Start of a G (general) command. Return a
CommandVisitor to handle
this command, or use the default to ignore it.Source§fn start_miscellaneous_code(
&mut self,
number: Number,
) -> ControlFlow<impl CommandVisitor + '_>
fn start_miscellaneous_code( &mut self, number: Number, ) -> ControlFlow<impl CommandVisitor + '_>
Start of an M (miscellaneous) command. Return a
CommandVisitor to handle
this command, or use the default to ignore it.Source§fn start_tool_change_code(
&mut self,
number: Number,
) -> ControlFlow<impl CommandVisitor + '_>
fn start_tool_change_code( &mut self, number: Number, ) -> ControlFlow<impl CommandVisitor + '_>
Start of a T (tool change) command. Return a
CommandVisitor to handle
this command, or use the default to ignore it.Source§impl CommandVisitor for Noop
impl CommandVisitor for Noop
Source§impl Diagnostics for Noop
impl Diagnostics for Noop
Source§fn emit_unknown_content(&mut self, text: &str, span: Span)
fn emit_unknown_content(&mut self, text: &str, span: Span)
Called when the parser sees text it cannot interpret (e.g. invalid tokens).
Source§fn emit_unexpected(&mut self, actual: &str, expected: &[TokenType], span: Span)
fn emit_unexpected(&mut self, actual: &str, expected: &[TokenType], span: Span)
Called when the parser expected one of
expected token types but found actual.Source§fn emit_parse_number_error(
&mut self,
value: &str,
error: ParseNumberError,
span: Span,
)
fn emit_parse_number_error( &mut self, value: &str, error: ParseNumberError, span: Span, )
Called when parsing a G/M/T number fails (e.g. overflow, invalid format).
Source§fn emit_parse_int_error(
&mut self,
value: &str,
_error: ParseIntError,
span: Span,
)
fn emit_parse_int_error( &mut self, value: &str, _error: ParseIntError, span: Span, )
Called when parsing an N or O number fails (e.g. invalid integer, overflow).
Source§impl ProgramVisitor for Noop
impl ProgramVisitor for Noop
Source§fn start_block(&mut self) -> ControlFlow<impl BlockVisitor + '_>
fn start_block(&mut self) -> ControlFlow<impl BlockVisitor + '_>
Called at the start of each block (line). Return a
BlockVisitor to
handle this block, or break to pause parsing.impl Copy for Noop
impl Eq for Noop
impl StructuralPartialEq for Noop
Auto Trait Implementations§
impl Freeze for Noop
impl RefUnwindSafe for Noop
impl Send for Noop
impl Sync for Noop
impl Unpin for Noop
impl UnwindSafe for Noop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> HasDiagnostics for Dwhere
D: Diagnostics,
impl<D> HasDiagnostics for Dwhere
D: Diagnostics,
Source§fn diagnostics(&mut self) -> &mut dyn Diagnostics
fn diagnostics(&mut self) -> &mut dyn Diagnostics
Returns a mutable reference to the diagnostics sink used for this parse.