blob: 37a9c83565fe3e873c0f517d3c02720f54875175 [file]
// Copyright 2026 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Layer-1 ground-up `#![no_std]` Rust `alloc` analog for Curry (`//sdk/vx/vx_alloc`).
//!
//! Depends strictly on `//sdk/vx/vx_core` and link-time C-ABI allocator symbols
//! (`__vx_alloc`, `__vx_dealloc`), with **zero `vx_zx` dependency**, zero
//! `AllocHandle` fields, and unprefixed Rust-standard type names (`Box`, `Vec`,
//! `String`, `RawVec`, `Layout`, `AllocError`).
//!
//! Architecture:
//! - Non-generic `#[curry::verified]` cores (`raw_alloc`, `raw_dealloc`,
//! `raw_box_*`, `raw_vec_*`, `String`) sit behind thin
//! `#[inline(always)]` generic wrappers (`Box<T>`, `Vec<T>`), keeping
//! compiled objects free of monomorphized generic SDK symbols (`GENERIC=0`)
//! and indirect `SRET(x8)` returns (`SRET=0`).
//! - All allocating operations are fallible (`Result<_, AllocError>`) with
//! atomic rollback on OOM and zero leaks.
#![no_std]
pub mod alloc;
pub mod boxed;
pub mod raw_vec;
pub mod string;
pub mod vec;
pub use alloc::{
AllocError, Layout, MAX_ALLOC_BYTES, is_valid_layout, raw_alloc, raw_alloc_zeroed, raw_dealloc,
};
pub use boxed::{Box, raw_box_alloc, raw_box_dealloc};
pub use raw_vec::{
RawVec, raw_vec_extend_bytes, raw_vec_free, raw_vec_next_cap, raw_vec_pop_bytes,
raw_vec_push_bytes, raw_vec_try_grow,
};
pub use string::{String, TryFromUtf8Error};
pub use vec::Vec;