pub struct Command<'a> { /* private fields */ }
Expand description
Commands are the operational unit of g-code
They consist of a G, M, or other top-level field followed by field arguments
Implementations§
Source§impl<'a> Command<'a>
impl<'a> Command<'a>
Sourcepub fn push(&mut self, arg: Field<'a>) -> Result<(), &'static str>
pub fn push(&mut self, arg: Field<'a>) -> Result<(), &'static str>
Add a field to the command.
Returns an error if the Field’s letters aren’t recognized.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Field<'_>>
pub fn iter(&self) -> impl Iterator<Item = &Field<'_>>
Iterate over all fields including the command’s name (i.e. G0 for rapid positioning)
Sourcepub fn into_token_vec(self) -> Vec<Token<'a>>
pub fn into_token_vec(self) -> Vec<Token<'a>>
Consumes the command to produce tokens suitable for output
Sourcepub fn iter_args(&self) -> impl Iterator<Item = &Field<'_>>
pub fn iter_args(&self) -> impl Iterator<Item = &Field<'_>>
Iterate over the fields after the command’s name
pub fn iter_mut_args(&mut self) -> impl Iterator<Item = &mut Field<'a>>
pub fn get(&self, letters: &str) -> Option<&Field<'_>>
pub fn set(&mut self, letters: &str, value: Value<'a>)
Trait Implementations§
impl<'a> StructuralPartialEq for Command<'a>
Auto Trait Implementations§
impl<'a> Freeze for Command<'a>
impl<'a> RefUnwindSafe for Command<'a>
impl<'a> Send for Command<'a>
impl<'a> Sync for Command<'a>
impl<'a> Unpin for Command<'a>
impl<'a> UnwindSafe for Command<'a>
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