gcode::core

Struct Noop

Source
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

Source§

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)

Comment content (excluding parentheses). Called for each comment on the line.
Source§

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)

Program delimiter % (RS-274 / ISO 6983). Called once per % token.
Source§

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 + '_>

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 + '_>

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 + '_>

Start of a T (tool change) command. Return a CommandVisitor to handle this command, or use the default to ignore it.
Source§

fn end_line(self, span: Span)

Called once at the end of the block. The parser consumes this visitor after this call; use it to finalize per-block state.
Source§

impl Clone for Noop

Source§

fn clone(&self) -> Noop

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CommandVisitor for Noop

Source§

fn argument(&mut self, letter: char, value: Value<'_>, span: Span)

One argument: address letter (e.g. 'X') and its Value with span.
Source§

fn end_command(self, span: Span)

Called once at the end of the command. The parser consumes this visitor after this call.
Source§

impl Debug for Noop

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Noop

Source§

fn default() -> Noop

Returns the “default value” for a type. Read more
Source§

impl Diagnostics for Noop

Source§

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)

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, )

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, )

Called when parsing an N or O number fails (e.g. invalid integer, overflow).
Source§

impl Hash for Noop

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Noop

Source§

fn eq(&self, other: &Noop) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ProgramVisitor for Noop

Source§

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.
Source§

impl Copy for Noop

Source§

impl Eq for Noop

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<D> HasDiagnostics for D
where D: Diagnostics,

Source§

fn diagnostics(&mut self) -> &mut dyn Diagnostics

Returns a mutable reference to the diagnostics sink used for this parse.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.