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§
Sourcefn snapshot(&self) -> BoxFuture<'_, Result<PrinterSnapshot, PrinterError>>
fn snapshot(&self) -> BoxFuture<'_, Result<PrinterSnapshot, PrinterError>>
Read the printer’s current state.
Sourcefn job(&self) -> BoxFuture<'_, Result<JobSnapshot, PrinterError>>
fn job(&self) -> BoxFuture<'_, Result<JobSnapshot, PrinterError>>
Read the job the printer reports it is running.
Sourcefn start(&self, file_name: FileName) -> BoxFuture<'_, Result<(), PrinterError>>
fn start(&self, file_name: FileName) -> BoxFuture<'_, Result<(), PrinterError>>
Start a print of a named file.
Sourcefn set_feedrate_factor(
&self,
factor: f64,
) -> BoxFuture<'_, Result<(), PrinterError>>
fn set_feedrate_factor( &self, factor: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>
Set the feedrate multiplier, where one means one hundred percent.
Sourcefn set_flowrate_factor(
&self,
factor: f64,
) -> BoxFuture<'_, Result<(), PrinterError>>
fn set_flowrate_factor( &self, factor: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>
Set the flowrate multiplier, where one means one hundred percent.
Sourcefn set_tool_target_c(
&self,
tool: i64,
target_c: f64,
) -> BoxFuture<'_, Result<(), PrinterError>>
fn set_tool_target_c( &self, tool: i64, target_c: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>
Set one tool’s target temperature, in degrees Celsius.
Sourcefn set_bed_target_c(
&self,
target_c: f64,
) -> BoxFuture<'_, Result<(), PrinterError>>
fn set_bed_target_c( &self, target_c: f64, ) -> BoxFuture<'_, Result<(), PrinterError>>
Set the bed’s target temperature, in degrees Celsius.
Sourcefn set_fan_percent(
&self,
percent: f64,
) -> BoxFuture<'_, Result<(), PrinterError>>
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".