pub fn get_allocator_type() -> AllocatorTypeExpand description
Get current allocator type
Returns the currently used allocator type, this is a simplified version of get_allocator_info().
If you only need to know the allocator type without other information, using this function is more concise.
§Return Value
Returns AllocatorType enum value, possible values:
AllocatorType::Mimalloc- Microsoft-developed high-performance allocatorAllocatorType::EmbeddedHeap- Embedded systems specific allocatorAllocatorType::System- System default allocator
§Example
use auto_allocator;
let allocator_type = auto_allocator::get_allocator_type();
// Simple allocator type check
if allocator_type == auto_allocator::AllocatorType::Mimalloc {
println!("Using high-performance mimalloc allocator");
}
// Or use match statement
match allocator_type {
auto_allocator::AllocatorType::Mimalloc => {
println!("mimalloc - optimal performance");
}
auto_allocator::AllocatorType::System => {
println!("system - maximum compatibility");
}
_ => println!("other allocator"),
}§Performance Notes
This function is slightly faster than get_allocator_info() because it only returns type information.