Command

Struct Command 

Source
pub struct Command {
    pub parts: Vec<CommandPart>,
    /* private fields */
}
Expand description

Represents a complete SCPI command with all its parts.

An SCPI command consists of multiple parts separated by colons, for example: “SYSTem:ERRor:NEXT?” is a command with three parts and is a query (ends with ‘?’).

The command can also have optional parts, indicated by square brackets, like: “[STATus]:EVENt?” where “STATus” is optional.

Fields§

§parts: Vec<CommandPart>

The parts of the command name.

Implementations§

Source§

impl Command

Source

pub fn is_query(&self) -> bool

Returns whether this command is a query (ends with a question mark).

Source

pub fn canonical_path(&self) -> String

Returns the canonical (long-form) representation of this command.

This is the complete command with all parts in their long form, separated by colons, and with a question mark at the end if it’s a query.

Source

pub fn paths(&self) -> Vec<CommandPath>

Generates all valid paths for this command.

Since SCPI commands can have optional parts and each part can be specified in either short or long form, this method generates all possible valid combinations.

§Returns

A vector of all valid command paths

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate 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 Debug for Command

Source§

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

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

impl TryFrom<&str> for Command

Source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Parses a command string into a Command structure.

§Arguments
  • value - The SCPI command string (e.g., “SYSTem:ERRor?” or “[STATus]:EVENt?”)
§Returns
  • Ok(Command) - Successfully parsed command
  • Err - If the command string is invalid
Source§

type Error = Box<dyn Error>

The type returned in the event of a conversion error.

Auto Trait Implementations§

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.