Skip to main content

PrinterPort

Trait PrinterPort 

Source
pub trait PrinterPort: Send + Sync {
    // Required methods
    fn snapshot(&self) -> BoxFuture<'_, Result<PrinterSnapshot, PrinterError>>;
    fn job(&self) -> BoxFuture<'_, Result<JobSnapshot, PrinterError>>;
    fn start(
        &self,
        file_name: FileName,
    ) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn pause(&self) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn resume(&self) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn cancel(&self) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn set_feedrate_factor(
        &self,
        factor: f64,
    ) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn set_flowrate_factor(
        &self,
        factor: f64,
    ) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn set_tool_target_c(
        &self,
        tool: i64,
        target_c: f64,
    ) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn set_bed_target_c(
        &self,
        target_c: f64,
    ) -> BoxFuture<'_, Result<(), PrinterError>>;
    fn set_fan_percent(
        &self,
        percent: f64,
    ) -> BoxFuture<'_, Result<(), PrinterError>>;
}
Expand description

The port the physical printer speaks through.

Every method is asynchronous, the trait is dyn-compatible, and it is shareable across threads, because the supervision core holds it behind Arc<dyn PrinterPort>.

Required Methods§

Source

fn snapshot(&self) -> BoxFuture<'_, Result<PrinterSnapshot, PrinterError>>

Read the printer’s current state.

Source

fn job(&self) -> BoxFuture<'_, Result<JobSnapshot, PrinterError>>

Read the job the printer reports it is running.

Source

fn start(&self, file_name: FileName) -> BoxFuture<'_, Result<(), PrinterError>>

Start a print of a named file.

Source

fn pause(&self) -> BoxFuture<'_, Result<(), PrinterError>>

Pause the print.

Source

fn resume(&self) -> BoxFuture<'_, Result<(), PrinterError>>

Resume the print.

Source

fn cancel(&self) -> BoxFuture<'_, Result<(), PrinterError>>

Cancel the print.

Source

fn set_feedrate_factor( &self, factor: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>

Set the feedrate multiplier, where one means one hundred percent.

Source

fn set_flowrate_factor( &self, factor: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>

Set the flowrate multiplier, where one means one hundred percent.

Source

fn set_tool_target_c( &self, tool: i64, target_c: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>

Set one tool’s target temperature, in degrees Celsius.

Source

fn set_bed_target_c( &self, target_c: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>

Set the bed’s target temperature, in degrees Celsius.

Source

fn set_fan_percent( &self, percent: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>

Set the part-cooling fan, in percent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§