Skip to main content

SpoolCommand

Enum SpoolCommand 

Source
pub enum SpoolCommand {
    RegisterSpool {
        name: String,
        material: String,
        color: Option<String>,
        diameter_mm: Option<f64>,
        density_g_cm3: Option<f64>,
        initial_g: f64,
        remaining_g: Option<f64>,
        tare_g: Option<f64>,
        reason: String,
        actor: Actor,
    },
    LoadSpool {
        spool_id: SpoolId,
        tool: i64,
        reason: String,
        actor: Actor,
    },
    UnloadSpool {
        spool_id: SpoolId,
        reason: String,
        actor: Actor,
    },
    AdjustSpool {
        spool_id: SpoolId,
        remaining_g: Option<f64>,
        gross_g: Option<f64>,
        reason: String,
        actor: Actor,
    },
    RetireSpool {
        spool_id: SpoolId,
        reason: String,
        actor: Actor,
    },
}
Expand description

The whole vocabulary of the spool ledger, and there is no other.

Variants§

§

RegisterSpool

Register a spool.

Fields

§name: String

The operator’s own label for it.

§material: String

The material, such as PLA.

§color: Option<String>

The filament’s colour.

§diameter_mm: Option<f64>

The filament’s diameter, in millimetres; 1.75 when absent.

§density_g_cm3: Option<f64>

The material’s density, in grams per cubic centimetre; the known density of the material when absent, and a material with none known is refused.

§initial_g: f64

The net filament on the spool when full, in grams.

§remaining_g: Option<f64>

The filament on it now, in grams; the full figure when absent.

§tare_g: Option<f64>

The empty spool’s own weight, in grams.

§reason: String

Why the actor is asking for this.

§actor: Actor

Who is asking.

§

LoadSpool

Load a spool onto a tool.

Onto an occupied tool it is a swap, and the spool there is unloaded in the same write. Naming the spool already on the tool confirms it was never swapped, which is accepted only while that tool holds a pending charge or that spool holds a filament-change mark.

Fields

§spool_id: SpoolId

The spool to load.

§tool: i64

The tool, in the printer’s own numbering.

§reason: String

Why the actor is asking for this.

§actor: Actor

Who is asking.

§

UnloadSpool

Unload a spool from its tool.

Fields

§spool_id: SpoolId

The spool to unload.

§reason: String

Why the actor is asking for this.

§actor: Actor

Who is asking.

§

AdjustSpool

Correct a spool’s remaining figure, from exactly one of the two; a command naming both or neither is refused as spool_refused.

Fields

§spool_id: SpoolId

The spool to correct.

§remaining_g: Option<f64>

The filament left, in grams.

§gross_g: Option<f64>

A scale reading of the spool, in grams, which needs its tare.

§reason: String

Why the actor is asking for this.

§actor: Actor

Who is asking.

§

RetireSpool

Retire a spool, after which it refuses every command.

Fields

§spool_id: SpoolId

The spool to retire.

§reason: String

Why the actor is asking for this.

§actor: Actor

Who is asking.

Implementations§

Source§

impl SpoolCommand

Source

pub const fn kind(&self) -> ActionKind

Which action this is, without its payload.

Source

pub fn reason(&self) -> &str

Why the actor asked for this.

Source

pub const fn actor(&self) -> &Actor

Who asked for this.

Trait Implementations§

Source§

impl Clone for SpoolCommand

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpoolCommand

Source§

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

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

impl<'de> Deserialize<'de> for SpoolCommand

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 JsonSchema for SpoolCommand

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for SpoolCommand

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Sample for SpoolCommand

Source§

fn sample_full() -> Self

A value carrying every field the type declares.
Source§

fn sample_minimal() -> Self

A value carrying every optional field absent.
Source§

fn sample_alternates() -> Vec<Self>

One value per further arm, for a type whose wire form is a union. Read more
Source§

impl Serialize for SpoolCommand

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 StructuralPartialEq for SpoolCommand

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.