Struct Line

Source
pub struct Line<'input, B: Buffers<'input> = DefaultBuffers> { /* private fields */ }
Expand description

A single line, possibly containing some Comments or GCodes.

Implementations§

Source§

impl<'input, B: Buffers<'input>> Line<'input, B>

Source

pub fn gcodes(&self) -> &[GCode<B::Arguments>]

All GCodes in this line.

Source

pub fn comments(&self) -> &[Comment<'input>]

All Comments in this line.

Source

pub fn push_gcode( &mut self, gcode: GCode<B::Arguments>, ) -> Result<(), CapacityError<GCode<B::Arguments>>>

Try to add another GCode to the line.

Source

pub fn push_comment( &mut self, comment: Comment<'input>, ) -> Result<(), CapacityError<Comment<'input>>>

Try to add a Comment to the line.

Source

pub fn is_empty(&self) -> bool

Does the Line contain anything at all?

Source

pub fn line_number(&self) -> Option<Word>

Try to get the line number, if there was one.

Source

pub fn set_line_number<W: Into<Option<Word>>>(&mut self, line_number: W)

Source

pub fn span(&self) -> Span

Get the Line’s position in its source text.

Trait Implementations§

Source§

impl<'input, B: Clone + Buffers<'input>> Clone for Line<'input, B>
where B::Commands: Clone, B::Comments: Clone,

Source§

fn clone(&self) -> Line<'input, B>

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<'input, B> Debug for Line<'input, B>
where B: Buffers<'input>,

Source§

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

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

impl<'input, B> Default for Line<'input, B>
where B: Buffers<'input>, B::Commands: Default, B::Comments: Default,

Source§

fn default() -> Line<'input, B>

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

impl<'de, 'input, B: Buffers<'input>> Deserialize<'de> for Line<'input, B>
where B::Commands: Deserialize<'de>, B::Comments: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'input, B: PartialEq + Buffers<'input>> PartialEq for Line<'input, B>

Source§

fn eq(&self, other: &Line<'input, B>) -> 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<'input, B: Buffers<'input>> Serialize for Line<'input, B>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'input, B: Buffers<'input>> StructuralPartialEq for Line<'input, B>

Auto Trait Implementations§

§

impl<'input, B> Freeze for Line<'input, B>
where <B as Buffers<'input>>::Commands: Freeze, <B as Buffers<'input>>::Comments: Freeze,

§

impl<'input, B> RefUnwindSafe for Line<'input, B>
where <B as Buffers<'input>>::Commands: RefUnwindSafe, <B as Buffers<'input>>::Comments: RefUnwindSafe,

§

impl<'input, B> Send for Line<'input, B>
where <B as Buffers<'input>>::Commands: Send, <B as Buffers<'input>>::Comments: Send,

§

impl<'input, B> Sync for Line<'input, B>
where <B as Buffers<'input>>::Commands: Sync, <B as Buffers<'input>>::Comments: Sync,

§

impl<'input, B> Unpin for Line<'input, B>
where <B as Buffers<'input>>::Commands: Unpin, <B as Buffers<'input>>::Comments: Unpin,

§

impl<'input, B> UnwindSafe for Line<'input, B>
where <B as Buffers<'input>>::Commands: UnwindSafe, <B as Buffers<'input>>::Comments: UnwindSafe,

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,