[−][src]Struct gcode::GCode
The in-memory representation of a single command in the G-code language
(e.g. "G01 X50.0 Y-20.0").
Methods
impl GCode[src]
pub fn new(mnemonic: Mnemonic, number: f32, span: Span) -> Self[src]
Create a new GCode which uses the DefaultArguments buffer.
impl<A: Buffer<Word>> GCode<A>[src]
pub fn new_with_argument_buffer(
mnemonic: Mnemonic,
number: f32,
span: Span,
arguments: A
) -> Self[src]
mnemonic: Mnemonic,
number: f32,
span: Span,
arguments: A
) -> Self
pub fn mnemonic(&self) -> Mnemonic[src]
The overall category this GCode belongs to.
pub fn major_number(&self) -> u32[src]
The integral part of a command number (i.e. the 12 in G12.3).
pub fn minor_number(&self) -> u32[src]
The fractional part of a command number (i.e. the 3 in G12.3).
pub fn arguments(&self) -> &[Word][src]
The arguments attached to this GCode.
pub fn span(&self) -> Span[src]
Where the GCode was found in its source text.
pub fn push_argument(&mut self, arg: Word) -> Result<(), CapacityError<Word>>[src]
Add an argument to the list of arguments attached to this GCode.
pub fn with_argument(self, arg: Word) -> Self[src]
The builder equivalent of GCode::push_argument().
Panics
This will panic if the underlying Buffer returns a
CapacityError.
pub fn value_for(&self, letter: char) -> Option<f32>[src]
Get the value for a particular argument.
Examples
let gcode = GCode::new(Mnemonic::General, 1.0, Span::PLACEHOLDER) .with_argument(Word::new('X', 30.0, Span::PLACEHOLDER)) .with_argument(Word::new('Y', -3.14, Span::PLACEHOLDER)); assert_eq!(gcode.value_for('Y'), Some(-3.14));
Trait Implementations
impl<A: Clone> Clone for GCode<A>[src]
impl<A: Buffer<Word>> Debug for GCode<A>[src]
impl<'de, A> Deserialize<'de> for GCode<A> where
A: Deserialize<'de>, [src]
A: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl<A: Buffer<Word>> Display for GCode<A>[src]
impl<A: Buffer<Word>> Extend<Word> for GCode<A>[src]
fn extend<I: IntoIterator<Item = Word>>(&mut self, words: I)[src]
impl<A: PartialEq> PartialEq<GCode<A>> for GCode<A>[src]
impl<A> Serialize for GCode<A> where
A: Serialize, [src]
A: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl<A> StructuralPartialEq for GCode<A>[src]
Auto Trait Implementations
impl<A> RefUnwindSafe for GCode<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
impl<A> Send for GCode<A> where
A: Send,
A: Send,
impl<A> Sync for GCode<A> where
A: Sync,
A: Sync,
impl<A> Unpin for GCode<A> where
A: Unpin,
A: Unpin,
impl<A> UnwindSafe for GCode<A> where
A: UnwindSafe,
A: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,