pub trait Protocol {
// Required methods
fn discover(&self) -> Vec<u8> ⓘ;
fn discovery_reply(&self, frame: &[u8]) -> Option<DiscoveryInfo>;
fn row(
&self,
buf: &mut Vec<u8>,
row: u16,
x: u16,
rgb: &[[u8; 3]],
order: ColorOrder,
);
fn latch(&self, brightness: u8) -> Vec<u8> ⓘ;
fn brightness(&self, brightness: u8) -> Vec<u8> ⓘ;
fn flash_read(&self, index: u16, page: u16) -> Vec<u8> ⓘ;
fn flash_reply<'a>(&self, frame: &'a [u8]) -> Option<&'a [u8]>;
fn flash_write(
&self,
map: &FlashMap,
index: u16,
block: u8,
page: u8,
data: &[u8],
) -> Result<Vec<u8>, WriteError>;
fn eeprom_write(&self, addr: u16, data: &[u8]) -> Vec<u8> ⓘ;
}Expand description
One vendor’s wire protocol as frame builders and reply parsers, the
surface ops drives a card through.
Colorlight is the only implementation; a second vendor implements
this in its own crate (docs/cards.md). Sequencing and sockets stay with
the caller.
Required Methods§
Sourcefn discovery_reply(&self, frame: &[u8]) -> Option<DiscoveryInfo>
fn discovery_reply(&self, frame: &[u8]) -> Option<DiscoveryInfo>
The card a discovery reply describes, if frame is one.
Sourcefn row(
&self,
buf: &mut Vec<u8>,
row: u16,
x: u16,
rgb: &[[u8; 3]],
order: ColorOrder,
)
fn row( &self, buf: &mut Vec<u8>, row: u16, x: u16, rgb: &[[u8; 3]], order: ColorOrder, )
One row packet into buf: screen row row, pixels from x.
Sourcefn latch(&self, brightness: u8) -> Vec<u8> ⓘ
fn latch(&self, brightness: u8) -> Vec<u8> ⓘ
The latch frame that applies the rows sent since the last one.
Sourcefn flash_read(&self, index: u16, page: u16) -> Vec<u8> ⓘ
fn flash_read(&self, index: u16, page: u16) -> Vec<u8> ⓘ
Read one chunk of flash at a 256-byte page index.
Sourcefn flash_reply<'a>(&self, frame: &'a [u8]) -> Option<&'a [u8]>
fn flash_reply<'a>(&self, frame: &'a [u8]) -> Option<&'a [u8]>
The flash bytes a reply carries, if frame is a flash reply.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".