Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/allocator/dedicated_block_allocator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/allocator/free_list_allocator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
16 changes: 8 additions & 8 deletions src/allocator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/visualizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl ColorScheme {
}
}

pub(crate) trait SubAllocatorVisualizer {
pub trait SubAllocatorVisualizer {
fn supports_visualization(&self) -> bool {
false
}
Expand Down
Loading