Skip to main content

Crate rusty_esp_core

Crate rusty_esp_core 

Source
Expand description

rusty_esp_core — the shared vocabulary of the Janus ESP family.

Every Janus package (rusty_esp_audio, rusty_esp_image, rusty_esp_video, rusty_esp_signal, rusty_esp_iroh, rusty_esp_mid) speaks these types at its boundary, so a camera frame from one crate flows into an encoder in another and onto the mesh in a third with no conversion and no copy.

What lives here, and the rule that keeps it small:

ModuleHoldsRule
timeMicros, a monotonic device timestamp; WallOffset, the host’s device→wall mapping with its error boundvalue type, no clock
errorError, one Copy error for the familyno String, no alloc
frameFrame, a borrowed image/video frameplanes over caller memory
pcmPcmBlock, a borrowed interleaved PCM blocksame
capabilityManifest, what a device can do, canonically encoded; capability::ParsedManifest reads it back (alloc)signed by rusty_esp_mid
mediaMediaPacket, a borrowed coded packet and its Codecthe shape every transport frames
halClock, Rng, Kv — the three seams every backend fillstraits only

Nothing here is a driver, an allocator, a codec, or a product type. If a type needs esp-hal, ESP-IDF, or a codec crate to define it, it does not belong in this crate.

Why borrowed frames. The FFmpeg-shaped Vec<Vec<u8>>-per-frame model is one-plus-N heap allocations per frame, returned by value. On a chip with 512 KB of SRAM that is the wrong shape at every level: allocation count, ownership, and the trait signatures it forces. Janus frames are views over memory the caller (a DMA ring, a static arena, a Vec on the host) already owns. Sources write into caller buffers; encoders read views.

Feature ladder: std ⊃ alloc ⊃ core-only. The crate compiles for riscv32imac-unknown-none-elf with --no-default-features.

Re-exports§

pub use capability::Capability;
pub use capability::Chip;
pub use capability::Declared;
pub use capability::Manifest;
pub use capability::Status;
pub use error::Error;
pub use frame::Frame;
pub use frame::FrameMut;
pub use frame::Geometry;
pub use frame::PixelFormat;
pub use frame::Plane;
pub use frame::PlaneMut;
pub use frame::Planes;
pub use frame::PlanesMut;
pub use hal::Clock;
pub use hal::Kv;
pub use hal::Rng;
pub use media::Codec;
pub use media::MediaPacket;
pub use pcm::PcmBlock;
pub use pcm::PcmFormat;
pub use pcm::SampleFormat;
pub use time::Micros;
pub use time::WallOffset;

Modules§

capability
The capability manifest — what a device can do, stated honestly.
error
One small, Copy, allocation-free error for the whole family.
frame
Borrowed image and video frames.
hal
The three seams every Janus backend fills.
media
The one coded-packet type the media packages share.
pcm
Borrowed PCM audio blocks.
prelude
The names a sketch, a backend or a function crate wants in scope.
time
Monotonic device time.

Constants§

FORMAT_VERSION
The wire/format version of every canonical encoding this crate defines. Bump only with an accept-both reader already shipped (see the Janus plan, “changing a format others already read”).
VERSION
Crate version, for capability manifests and logs.