pub trait LcdText<const W: usize, const H: usize> {
const ADDRESS: u8;
const WIDTH: usize = W;
const HEIGHT: usize = H;
// Required method
fn write_text(&self, text: impl AsRef<str>);
}Expand description
Platform-agnostic LCD text device contract.
Platform crates implement this trait for their generated LCD text types so shared logic can write text without knowing the hardware backend.
Design intent:
- This trait is intended for static dispatch on embedded targets.
- Dimensions are const generics so geometry remains compile-time.
write_textaccepts any string-like input viaAsRef<str>.
§Example: Write Text
This example writes text through a generic trait-bound helper.
use device_envoy_core::lcd_text::LcdText;
fn write_message<const W: usize, const H: usize>(lcd_text: &impl LcdText<W, H>) {
lcd_text.write_text("Hello from\ndevice-envoy!");
}
Required Associated Constants§
Provided Associated Constants§
Required Methods§
Sourcefn write_text(&self, text: impl AsRef<str>)
fn write_text(&self, text: impl AsRef<str>)
Write text to the display. See the LcdText trait documentation for usage examples.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.