pub trait PrinterPort: Send + Sync {
Show 18 methods
// 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>>;
// Provided methods
fn file_facts(
&self,
file_name: FileName,
) -> BoxFuture<'_, Result<FileFacts, PrinterError>> { ... }
fn printed_files(
&self,
) -> BoxFuture<'_, Result<Vec<FileFacts>, PrinterError>> { ... }
fn extruded_to(
&self,
file_name: FileName,
position_bytes: i64,
) -> BoxFuture<'_, Result<Vec<ToolFilament>, PrinterError>> { ... }
fn printed_extent(
&self,
file_name: FileName,
position_bytes: i64,
) -> BoxFuture<'_, Result<Option<PrintedExtent>, PrinterError>> { ... }
fn read_position(&self) -> BoxFuture<'_, Result<AxisPosition, PrinterError>> { ... }
fn push_events(
&self,
) -> BoxFuture<'_, Result<BoxStream<'static, PrinterPush>, PrinterError>> { ... }
fn send_command(
&self,
command: PrinterCommand,
) -> 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.
Provided Methods§
Sourcefn file_facts(
&self,
file_name: FileName,
) -> BoxFuture<'_, Result<FileFacts, PrinterError>>
fn file_facts( &self, file_name: FileName, ) -> BoxFuture<'_, Result<FileFacts, PrinterError>>
Read what the printer knows of one file it holds.
A printer that cannot answer is refused with status 501, which is what an implementation that does not override this answers.
Sourcefn printed_files(&self) -> BoxFuture<'_, Result<Vec<FileFacts>, PrinterError>>
fn printed_files(&self) -> BoxFuture<'_, Result<Vec<FileFacts>, PrinterError>>
Read every file the printer holds that carries a print tally.
A printer that cannot answer is refused with status 501, which is what an implementation that does not override this answers.
Sourcefn extruded_to(
&self,
file_name: FileName,
position_bytes: i64,
) -> BoxFuture<'_, Result<Vec<ToolFilament>, PrinterError>>
fn extruded_to( &self, file_name: FileName, position_bytes: i64, ) -> BoxFuture<'_, Result<Vec<ToolFilament>, PrinterError>>
Read the filament each tool is fed by one file’s own moves, from its start up to a byte position in it.
A printer that cannot answer is refused with status 501, which is what an implementation that does not override this answers.
Sourcefn printed_extent(
&self,
file_name: FileName,
position_bytes: i64,
) -> BoxFuture<'_, Result<Option<PrintedExtent>, PrinterError>>
fn printed_extent( &self, file_name: FileName, position_bytes: i64, ) -> BoxFuture<'_, Result<Option<PrintedExtent>, PrinterError>>
Read what one file printed from its start up to a byte position in it: the highest Z an extruding move reached and the XY rectangle of every extruding move. Nothing when no move up to the position extruded.
A printer that cannot answer is refused with status 501, which is what an implementation that does not override this answers.
Sourcefn read_position(&self) -> BoxFuture<'_, Result<AxisPosition, PrinterError>>
fn read_position(&self) -> BoxFuture<'_, Result<AxisPosition, PrinterError>>
Read where the print head is now, as the printer reports it.
A position says nothing about whether an axis was homed. A printer that cannot answer is refused with status 501, which is what an implementation that does not override this answers.
Sourcefn push_events(
&self,
) -> BoxFuture<'_, Result<BoxStream<'static, PrinterPush>, PrinterError>>
fn push_events( &self, ) -> BoxFuture<'_, Result<BoxStream<'static, PrinterPush>, PrinterError>>
Open the printer’s push channel, answering what it pushes from now on.
The stream ends when the channel drops; opening it again is how a reader reconnects. A printer that cannot push is refused with status 501, which is what an implementation that does not override this answers.
Sourcefn send_command(
&self,
command: PrinterCommand,
) -> BoxFuture<'_, Result<(), PrinterError>>
fn send_command( &self, command: PrinterCommand, ) -> BoxFuture<'_, Result<(), PrinterError>>
Send one command of the closed vocabulary PrinterCommand names,
rendered by the implementation to its own line.
What the printer answers arrives, when it answers anything, on the push channel. A printer that cannot take one is refused with status 501, which is what an implementation that does not override this answers.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".