Struct gcode::Gcode [−][src]
pub struct Gcode { /* fields omitted */ }
A single command in the gcode
programming language.
Methods
impl Gcode
[src]
impl Gcode
pub fn new(mnemonic: Mnemonic, number: f32, span: Span) -> Gcode
[src]
pub fn new(mnemonic: Mnemonic, number: f32, span: Span) -> Gcode
Create a new Gcode
.
pub fn mnemonic(&self) -> Mnemonic
[src]
pub fn mnemonic(&self) -> Mnemonic
Get the Mnemonic
used by this Gcode
.
pub fn span(&self) -> Span
[src]
pub fn span(&self) -> Span
Get the location of this Gcode
in the original text.
pub fn args(&self) -> &[Word]
[src]
pub fn args(&self) -> &[Word]
The arguments provided to the Gcode
.
pub fn line_number(&self) -> Option<u32>
[src]
pub fn line_number(&self) -> Option<u32>
Get the line number given to this gode (e.g. the 20
in N20 G04 P100
).
pub fn number(&self) -> f32
[src]
pub fn number(&self) -> f32
The number associated with this Gcode
(e.g. the 01
in G01 X123
).
pub fn major_number(&self) -> u32
[src]
pub fn major_number(&self) -> u32
The integral part of the Gcode
's number field.
pub fn minor_number(&self) -> Option<u32>
[src]
pub fn minor_number(&self) -> Option<u32>
The first digit after the decimal point, if there was one.
Note
For all intents and purposes, a gcode like G1.0
doesn't really have
a minor number.
pub fn add_argument(&mut self, arg: Word)
[src]
pub fn add_argument(&mut self, arg: Word)
Add an argument to this Gcode
's argument list.
pub fn with_argument(self, arg: Word) -> Self
[src]
pub fn with_argument(self, arg: Word) -> Self
A builder method for adding an argument to the Gcode
.
pub fn with_line_number(self, number: u32, span: Span) -> Self
[src]
pub fn with_line_number(self, number: u32, span: Span) -> Self
A builder method for attaching a line number (the 30
in N30 G01 X32
)
to a command.
pub fn value_for(&self, letter: char) -> Option<f32>
[src]
pub fn value_for(&self, letter: char) -> Option<f32>
Find the value for the desired argument.
Trait Implementations
impl Debug for Gcode
[src]
impl Debug for Gcode
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Gcode
[src]
impl Default for Gcode
impl Clone for Gcode
[src]
impl Clone for Gcode
fn clone(&self) -> Gcode
[src]
fn clone(&self) -> Gcode
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Gcode
[src]
impl PartialEq for Gcode
fn eq(&self, other: &Gcode) -> bool
[src]
fn eq(&self, other: &Gcode) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Gcode) -> bool
[src]
fn ne(&self, other: &Gcode) -> bool
This method tests for !=
.
impl Display for Gcode
[src]
impl Display for Gcode