Skip to main content

Crate phoros

Crate phoros 

Source
Expand description

Zero-allocation ring buffer with XOR delta encoding and state rollback.

phoros records state snapshots and byte-masked deltas into a pre-allocated arena.

§Quickstart

use phoros::bprb;

let mut buf = bprb!(u64 => stack(1024)).unwrap();
buf.snapshot(&42u64).unwrap();
assert_eq!(buf.rollback_to(0).unwrap(), 42u64);

§Feature flags

FeatureDefaultEnables
stdYesBoxedBPRB, std::error::Error impls
allocVia stdBoxedBPRB, bprb!() boxed variant
serdeNoSerialize/Deserialize for SlotType, SlotHeader, AnchorEntry, error types

Bare no_std (no features) gives StackBPRB and bprb!() stack variant only.

Re-exports§

pub use buffer::BoxedBPRB;
pub use buffer::StackBPRB;
pub use buffer::BPRB;
pub use buffer::DEFAULT_ANCHOR_INTERVAL;
pub use buffer::DEFAULT_DELTA_THRESHOLD;
pub use error::BufferError;
pub use error::CodecError;
pub use error::RollbackError;
pub use slot::SlotType;
pub use storage::ArenaStorage;

Modules§

arena
buffer
codec
error
index
slot
storage

Macros§

bprb
Construct a BPRB with STATE_SIZE and MAX_ENCODED derived automatically from the concrete type.