Struct bitcoin_support::Arena
source · pub struct Arena { /* private fields */ }Expand description
| An arena manages a contiguous region | of memory by dividing it into chunks. |
Implementations§
source§impl Arena
impl Arena
sourcepub fn address_in_arena(&self, _ptr: *mut c_void) -> bool
pub fn address_in_arena(&self, _ptr: *mut c_void) -> bool
| Return whether a pointer points inside | this arena. | | This returns base <= ptr < (base+size) | so only use it for (inclusive) chunk | starting addresses. |
pub fn new(_base_in: *mut c_void, _size_in: usize, _alignment_in: usize) -> Self
sourcepub fn alloc(&mut self, _size: usize)
pub fn alloc(&mut self, _size: usize)
| Allocate size bytes from this arena. | | Returns pointer on success, or 0 if memory | is full or the application tried to allocate | 0 bytes. |
sourcepub fn free(&mut self, _ptr: *mut c_void)
pub fn free(&mut self, _ptr: *mut c_void)
| Free a previously allocated chunk of | memory. | | Freeing the zero pointer has no effect. | | Raises std::runtime_error in case | of error. |
sourcepub fn stats(&self) -> ArenaStats
pub fn stats(&self) -> ArenaStats
| Get arena usage statistics |
Auto Trait Implementations§
impl !RefUnwindSafe for Arena
impl !Send for Arena
impl !Sync for Arena
impl Unpin for Arena
impl !UnwindSafe for Arena
Blanket Implementations§
§impl<T, U> CastInto<U> for Twhere
U: CastFrom<T>,
impl<T, U> CastInto<U> for Twhere U: CastFrom<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> StaticUpcast<T> for T
impl<T> StaticUpcast<T> for T
§unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
Convert type of a const pointer. Read more