#distributed-systems #memory-safety #ownership

no-std praborrow-core

Core primitives for PraBorrow. Implements Sovereign<T> for distributed ownership enforcement.

23 releases (8 stable)

Uses new Rust 2024

1.2.2 Jan 14, 2026
0.9.3 Jan 12, 2026

#13 in #ownership


Used in 6 crates

MIT license

28KB
473 lines

Praborrow Core

English | Indonesia

Core primitives for the PraBorrow distributed systems framework. This crate provides the foundational types for enforcing sovereign ownership semantics across network boundaries.

Sovereign

The Sovereign<T> wrapper implements a distinct state machine for data ownership:

  • Domestic: Data is local and accessible via Deref.
  • Exiled: Data has been moved to a remote node. Access attempts trigger a panic (or return Err with try_get).

Usage

use praborrow_core::{Sovereign, SovereigntyError};

let data = Sovereign::new(42);

// Access allowed (Domestic)
assert_eq!(*data, 42);

// Safe access with error handling (v0.5+)
assert!(data.try_get().is_ok());

// Transition state
data.annex().expect("Failed to annex resource");

// Graceful error handling instead of panic
match data.try_get() {
    Ok(_) => unreachable!(),
    Err(SovereigntyError::ForeignJurisdiction) => println!("Exiled!"),
}

Thread Safety

Uses AtomicU8 for state tracking, ensuring Send + Sync compliance where T: Send + Sync.

Dependencies

~4.5–7.5MB
~62K SLoC