Replace em dashes with hyphens across docs and comments

This commit is contained in:
2026-08-29 08:13:54 +00:00
parent 1583f531fa
commit a2d4e578ec
21 changed files with 104 additions and 104 deletions
+16 -16
View File
@@ -1,24 +1,24 @@
//! Printer hierarchy — the Rust answer to
//! Printer hierarchy - the Rust answer to
//! `GenericPrinter -> BambuV1/BambuV2/PrusaLink/PrusaSerial/Klipper`-style
//! inheritance, since Rust structs can't `extend` each other.
//!
//! Bambu goes one level deeper than the others: `bambu.rs` has
//! `BambuGenericPrinter` (fields + behavior every Bambu printer shares —
//! `BambuGenericPrinter` (fields + behavior every Bambu printer shares -
//! access code, CA trust, the TLS handshake test/fetch) which
//! `BambuV1Printer`/`BambuV2Printer` each *have* one of, mirroring the
//! `GenericPrinter -> BambuGenericPrinter -> BambuV1/V2` chain this project
//! actually wanted from the start — see that file's doc comment.
//! actually wanted from the start - see that file's doc comment.
//!
//! Three pieces, each doing one job an OOP base class would normally do:
//!
//! 1. `PrinterBase` — a plain struct holding the shared *fields*. Every
//! 1. `PrinterBase` - a plain struct holding the shared *fields*. Every
//! printer struct below *has* one of these (composition) instead of
//! *extending* one.
//! 2. `GenericPrinter` — a trait holding the shared *behavior*. `connect()`
//! 2. `GenericPrinter` - a trait holding the shared *behavior*. `connect()`
//! has no default body, so every printer type is forced to write its
//! own — that's what "overriding" looks like when there's no inherited
//! own - that's what "overriding" looks like when there's no inherited
//! body to override in the first place.
//! 3. `PrinterHandle` — an enum listing the closed set of printer kinds.
//! 3. `PrinterHandle` - an enum listing the closed set of printer kinds.
//! Stands in for "any subclass of GenericPrinter".
//!
//! Run `cargo run --example printer_polymorphism` to see it in action.
@@ -41,7 +41,7 @@ pub use bambu_commands::{
pub use klipper::KlipperPrinter;
pub use prusa::{PrusaLinkPrinter, PrusaSerialPrinter};
/// A tiny error type: just a message. `String` would work too — this exists
/// A tiny error type: just a message. `String` would work too - this exists
/// mainly so `?` has something concrete to convert into everywhere.
#[derive(Debug, thiserror::Error)]
#[error("{0}")]
@@ -55,7 +55,7 @@ pub struct PrinterBase {
pub host: String,
}
/// The shared interface — think `interface GenericPrinter` (Java/TS) or an
/// The shared interface - think `interface GenericPrinter` (Java/TS) or an
/// ABC (Python). Every vendor's struct implements this.
pub trait GenericPrinter {
/// Read-only access to the shared fields.
@@ -64,23 +64,23 @@ pub trait GenericPrinter {
/// REQUIRED, no default body: every vendor speaks a different protocol,
/// so there's nothing sensible to share here. Each `impl` in
/// `bambu.rs`/`prusa.rs`/`klipper.rs` provides a totally different
/// body — that's the override.
/// body - that's the override.
///
/// `cargo check` will warn about `async fn` in a public trait here.
/// That's about a more advanced concern (whether the resulting work can
/// safely move across OS threads) that only matters once this is wired
/// into the multi-threaded daemon — safe to ignore for now.
/// into the multi-threaded daemon - safe to ignore for now.
async fn connect(&mut self) -> Result<(), PrinterError>;
/// REQUIRED, no default body: `percent` is 0-100, but how it actually
/// gets sent — an MQTT gcode-injection command, a REST call, raw bytes
/// on a serial port — is different for every vendor, same as
/// gets sent - an MQTT gcode-injection command, a REST call, raw bytes
/// on a serial port - is different for every vendor, same as
/// `connect()`.
async fn set_fan_speed(&mut self, percent: u8) -> Result<(), PrinterError>;
/// OPTIONAL: a default body every printer gets for free unless it
/// writes its own. None of ours do below, so all three vendors share
/// this exact implementation — the trait-method equivalent of
/// this exact implementation - the trait-method equivalent of
/// inheriting a base-class method unchanged.
fn display_name(&self) -> String {
format!("{} ({})", self.base().name, self.base().id)
@@ -89,7 +89,7 @@ pub trait GenericPrinter {
/// M106's `S` parameter is a raw 0-255 PWM value, not a percentage. Shared
/// by anything that ultimately sends gcode (Bambu, PrusaLink, PrusaSerial)
/// — *not* a trait default, since Klipper's hypothetical native fan API
/// - *not* a trait default, since Klipper's hypothetical native fan API
/// below takes a percent directly and has no use for this at all. Private,
/// but still visible to bambu.rs/prusa.rs: Rust's module privacy reaches
/// into child modules, not just the exact file it's defined in.
@@ -109,7 +109,7 @@ pub enum PrinterHandle {
// Hand-written delegation: each trait method just matches on the variant
// and forwards to that variant's own implementation. This one block is the
// only "boilerplate tax" for not having inheritance — everything else reads
// only "boilerplate tax" for not having inheritance - everything else reads
// like normal code.
impl GenericPrinter for PrinterHandle {
fn base(&self) -> &PrinterBase {