Commit graph

4 commits

Author SHA1 Message Date
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
Sean Cross
8e27dce59c flatipc: release 0.1.2
This releases flatipc 0.1.2 with more documentation and a new
`Ipc::from_memory_message()` call to reconstitute an object from a
xous::MemoryMessage.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-23 19:32:54 +08:00
Sean Cross
0c5b011fcf flatipc-derive: remove outdated header
Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-22 18:51:40 +08:00
Sean Cross
a77fdac6f0 libs: add flatipc implementation
flatipc is a new method for doing IPC. This is a zero-copy approach
where structs are given `repr(C)` implementations that are well-defined
and work across process boundaries.

If the same struct or enum is used in two processes that has the same
layout, then data can be freely passed between the two processes without
incurring a serialization or deserialization penalty, provided the
following hold:

1. The buffer must be page-aligned and be a multiple of the page size
2. The item must be `#[repr(C)]`
3. There must be no pointers or references of any kind

If these three things hold, then the object is safe to sling across the
process boundary.

This crate adds the ability to annotate structs with
`#[derive(flatipc::Ipc)]` to provide them with this functionality. When
doing so, objects gain the `.into_ipc()` call that turns them into
something that can be sent across process boundaries.

The resulting object has `.lend()`, `.lend_mut()`, `.try_lend()`, and
`.try_lend_mut()` as functions.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-09-22 18:32:58 +08:00