oxidecomputer / idolatry

An experimental IPC interface definition language for Hubris.
Mozilla Public License 2.0
17 stars 11 forks source link

Add trait that supports either arrays or leases #53

Open mkeeter opened 3 months ago

mkeeter commented 3 months ago

It would be convenient to write code that's generic against Leased<W, [u8]> and &mut [u8] (and Leased<R, [u8]> and &[u8]). Such a trait should live in the idol_runtime crate.

Edit: I found BufReader and BufWriter, which are close, but are reader/writer-flavored rather than array-flavored.

cbiffle commented 3 months ago

Seems reasonable. The only reason the existing API uses read/writer flavors is because that's what the code needed when I wrote the API --- in the interest of not adding speculative features before they're used. A random-access variant would make perfect sense.