Skip to content

Commit

Permalink
Make FrameAllocator::new const
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-TSNG committed Jul 26, 2024
1 parent 52eac27 commit eea4d1c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/frame.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::prev_power_of_two;
use alloc::collections::BTreeSet;
use core::alloc::Layout;
use core::array;
use core::cmp::{max, min};
use core::ops::Range;

Expand Down Expand Up @@ -41,9 +40,9 @@ pub struct FrameAllocator<const ORDER: usize = 32> {

impl<const ORDER: usize> FrameAllocator<ORDER> {
/// Create an empty frame allocator
pub fn new() -> Self {
pub const fn new() -> Self {
Self {
free_list: array::from_fn(|_| BTreeSet::default()),
free_list: [const { BTreeSet::new() }; ORDER],
allocated: 0,
total: 0,
}
Expand Down

0 comments on commit eea4d1c

Please sign in to comment.