diff --git a/src/allocator/dedicated_block_allocator/mod.rs b/src/allocator/dedicated_block_allocator/mod.rs index 02bb13df..d0989964 100644 --- a/src/allocator/dedicated_block_allocator/mod.rs +++ b/src/allocator/dedicated_block_allocator/mod.rs @@ -18,7 +18,7 @@ use super::{AllocationReport, AllocationType, SubAllocator, SubAllocatorBase}; use crate::{AllocationError, Result}; #[derive(Debug)] -pub(crate) struct DedicatedBlockAllocator { +pub struct DedicatedBlockAllocator { size: u64, allocated: u64, /// Only used if [`crate::AllocatorDebugSettings::store_stack_traces`] is [`true`] @@ -28,7 +28,7 @@ pub(crate) struct DedicatedBlockAllocator { } impl DedicatedBlockAllocator { - pub(crate) fn new(size: u64) -> Self { + pub fn new(size: u64) -> Self { Self { size, allocated: 0, diff --git a/src/allocator/free_list_allocator/mod.rs b/src/allocator/free_list_allocator/mod.rs index db969d68..35142b7d 100644 --- a/src/allocator/free_list_allocator/mod.rs +++ b/src/allocator/free_list_allocator/mod.rs @@ -46,7 +46,7 @@ pub(crate) struct MemoryChunk { } #[derive(Debug)] -pub(crate) struct FreeListAllocator { +pub struct FreeListAllocator { size: u64, allocated: u64, pub(crate) chunk_id_counter: u64, @@ -74,7 +74,7 @@ fn has_granularity_conflict(type0: AllocationType, type1: AllocationType) -> boo } impl FreeListAllocator { - pub(crate) fn new(size: u64) -> Self { + pub fn new(size: u64) -> Self { #[allow(clippy::unwrap_used)] let initial_chunk_id = core::num::NonZeroU64::new(1).unwrap(); diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index 523ebcbd..eda9a52c 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -9,15 +9,15 @@ use log::*; use crate::result::*; -pub(crate) mod dedicated_block_allocator; -pub(crate) use dedicated_block_allocator::DedicatedBlockAllocator; +pub mod dedicated_block_allocator; +pub use dedicated_block_allocator::DedicatedBlockAllocator; -pub(crate) mod free_list_allocator; -pub(crate) use free_list_allocator::FreeListAllocator; +pub mod free_list_allocator; +pub use free_list_allocator::FreeListAllocator; #[derive(PartialEq, Copy, Clone, Debug)] #[repr(u8)] -pub(crate) enum AllocationType { +pub enum AllocationType { Free, Linear, NonLinear, @@ -106,11 +106,11 @@ impl fmt::Debug for AllocatorReport { } #[cfg(feature = "visualizer")] -pub(crate) trait SubAllocatorBase: crate::visualizer::SubAllocatorVisualizer {} +pub trait SubAllocatorBase: crate::visualizer::SubAllocatorVisualizer {} #[cfg(not(feature = "visualizer"))] -pub(crate) trait SubAllocatorBase {} +pub trait SubAllocatorBase {} -pub(crate) trait SubAllocator: SubAllocatorBase + fmt::Debug + Sync + Send { +pub trait SubAllocator: SubAllocatorBase + fmt::Debug + Sync + Send { fn allocate( &mut self, size: u64, diff --git a/src/lib.rs b/src/lib.rs index 0906aabf..2eef751b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -227,9 +227,12 @@ compile_error!("Either `std` or `hashbrown` feature must be enabled"); mod result; pub use result::*; -pub(crate) mod allocator; +pub mod allocator; -pub use allocator::{AllocationReport, AllocatorReport, MemoryBlockReport}; +pub use allocator::{ + AllocationReport, AllocatorReport, DedicatedBlockAllocator, FreeListAllocator, + MemoryBlockReport, +}; #[cfg(feature = "visualizer")] pub mod visualizer; @@ -421,7 +424,7 @@ impl AllocationSizes { /// (where the requested allocation didn't fit), the larger /// the returned memory block size is going to be (up to /// `max_*_memblock_size`). - pub(crate) fn get_memblock_size(&self, is_host: bool, count: usize) -> u64 { + pub fn get_memblock_size(&self, is_host: bool, count: usize) -> u64 { let (min_size, max_size) = if is_host { (self.min_host_memblock_size, self.max_host_memblock_size) } else { diff --git a/src/visualizer/mod.rs b/src/visualizer/mod.rs index 113c8454..14fba781 100644 --- a/src/visualizer/mod.rs +++ b/src/visualizer/mod.rs @@ -39,7 +39,7 @@ impl ColorScheme { } } -pub(crate) trait SubAllocatorVisualizer { +pub trait SubAllocatorVisualizer { fn supports_visualization(&self) -> bool { false }