rstd 0.1.0
Loading...
Searching...
No Matches
rstd.alloc Module Reference

Exported Modules

module  rstd.core
 

Classes

class  alloc::rc::Rc< T >
 A single-threaded reference-counting pointer, analogous to Rust's Rc<T>. More...
 
class  alloc::rc::Weak< T >
 A non-owning reference to an Rc-managed allocation that does not prevent deallocation. More...
 
class  alloc::ffi::CString
 An owned, C-compatible, nul-terminated string, analogous to Rust's CString. More...
 
class  alloc::boxed::Box< T >
 A pointer type that uniquely owns a heap allocation of type T. More...
 
struct  alloc::Global
 The global memory allocator, implementing the Allocator trait. More...
 
class  alloc::vec::Vec< T >
 A contiguous growable array type, analogous to Rust's Vec<T>. More...
 
class  alloc::string::String
 A UTF-8 encoded, growable string, analogous to Rust's String. More...
 
struct  alloc::string::ToString
 A trait for converting a value to a String. More...
 
class  alloc::sync::Arc< T >
 A thread-safe reference-counting pointer, analogous to Rust's Arc<T>. More...
 
class  alloc::sync::Weak< T >
 A non-owning, weakly-referenced companion to Arc that does not prevent deallocation. More...
 
class  alloc::sync::ArcRaw< T >
 A raw representation of an Arc pointer, used for low-level interop. More...
 

Functions

template<typename T , StoragePolicy Sp = StoragePolicy::Separate, typename... Args>
requires (! mtp::is_array<T>)
auto alloc::rc::make_rc (Args &&... args) -> Rc< T >
 Constructs an Rc<T> by allocating and constructing T in place.
 
template<typename T , StoragePolicy Sp = StoragePolicy::Separate, typename... Args>
requires mtp::is_array<T>
auto alloc::rc::make_rc (usize n, const typename Rc< T >::const_value_t &init) -> Rc< T >
 Constructs an Rc<T[]> for an array type, initializing n elements with init.
 
template<typename T , StoragePolicy Sp = StoragePolicy::Separate, typename Allocator , typename... Args>
requires (! mtp::is_array<T>)
auto alloc::rc::allocate_make_rc (const Allocator &alloc, Args &&... args) -> Rc< T >
 Constructs an Rc<T> using a custom allocator, constructing T in place.
 
template<typename T , StoragePolicy Sp = StoragePolicy::Separate, typename Allocator >
requires mtp::is_array<T>
auto alloc::rc::allocate_make_rc (const Allocator &alloc, usize n, typename Rc< T >::const_value_t &t) -> Rc< T >
 Constructs an Rc<T[]> for an array type using a custom allocator.
 
template<typename T >
void alloc::rc::swap (Rc< T > &lhs, Rc< T > &rhs) noexcept
 Swaps two Rc pointers.
 
auto alloc::alloc (Layout layout) noexcept -> mut_ptr< u8 >
 Allocates memory with the given layout using the global allocator.
 
void alloc::dealloc (mut_ptr< u8 > ptr, Layout layout) noexcept
 Deallocates memory previously allocated with the given layout.
 
auto alloc::realloc (mut_ptr< u8 > ptr, Layout layout, usize new_size) noexcept -> mut_ptr< u8 >
 Reallocates memory to a new size, preserving existing data up to the minimum of old and new sizes.
 
auto alloc::alloc_zeroed (Layout layout) noexcept -> mut_ptr< u8 >
 Allocates zero-initialized memory with the given layout.
 
void alloc::handle_alloc_error (Layout layout)
 Aborts the process on memory allocation failure.
 
template<typename... Args>
auto rstd::fmt::format (fmt::format_string< Args... > fmt_str, Args &&... args) -> String
 Creates a String using format syntax, analogous to Rust's format! macro.
 
template<Impled< ToString > A>
auto rstd::to_string (A &&a)
 Converts a value that implements ToString into a String.
 

Variables

Global alloc::GLOBAL {}
 The singleton instance of the global allocator.
 

Files

file  /home/runner/work/rstd/rstd/src/core/alloc/mod.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/alloc.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/boxed.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/ffi/c_str.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/ffi/mod.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/vec/mod.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/rc.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/str.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/string.cppm
 
file  /home/runner/work/rstd/rstd/src/alloc/sync.cppm