From d5c5160658274ff7bcf1da5b7afef63de32b4fa3 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 31 Jan 2025 09:43:12 +0100 Subject: [PATCH] squash! fix(coapcore): overhault pub'ness Items in oluru remain pub in order to run their tests; the whole module is only pub for testing anyway. --- src/lib/coapcore/src/oluru.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/coapcore/src/oluru.rs b/src/lib/coapcore/src/oluru.rs index 0cb094087..885db0794 100644 --- a/src/lib/coapcore/src/oluru.rs +++ b/src/lib/coapcore/src/oluru.rs @@ -22,7 +22,7 @@ use arrayvec::ArrayVec; /// Priority levels follow the conventions common with schedulers: 0 is the highest priority, and /// will only get evicted if the cache is full with other entries of the same priority. Larger /// numeric values indicate increasingly lower priority. -pub(crate) trait PriorityLevel { +pub trait PriorityLevel { /// Calculate the priority of the instance /// /// An instance's priority level may change while being mutated; [`OrderedPool`] will account for @@ -111,7 +111,7 @@ pub(crate) trait PriorityLevel { /// values is unique, and is an index into `.entries`. /// * If `T::level` is constant, `self.sorted.iter().map(|i| self.entries[i].level())` is sorted. #[derive(Debug)] -pub(crate) struct OrderedPool { +pub struct OrderedPool { /// Elements without regard for ordering pub entries: ArrayVec, /// A sorted list of indices into entries: high priority first, ties broken by recentness @@ -120,7 +120,7 @@ pub(crate) struct OrderedPool impl OrderedPool { /// Create an empty cache. - pub(crate) const fn new() -> Self { + pub const fn new() -> Self { assert!(N < u16::MAX as usize, "Capacity overflow"); // Clipping levels to u16 because they may be stored if the implementation changes. assert!(L < u16::MAX as usize, "Level overflow"); @@ -145,7 +145,7 @@ impl OrderedPool { /// * The callback is split in a test part and a use part, which ensures that elements that are /// not looked up do not get mutated; only the selected item is mutated and will then be /// sorted in correctly. - pub(crate) fn lookup(&mut self, mut f_test: Ftest, f_use: Fuse) -> Option + pub fn lookup(&mut self, mut f_test: Ftest, f_use: Fuse) -> Option where Ftest: FnMut(&T) -> bool, Fuse: FnOnce(&mut T) -> R, @@ -170,7 +170,7 @@ impl OrderedPool { dead_code, reason = "Need for this function is unclear, but it is covered in tests and docs, and may easily be needed again as coapcore is being refactored." )] - pub(crate) fn insert(&mut self, new: T) -> Result, T> { + pub fn insert(&mut self, new: T) -> Result, T> { let new_index = self.entries.len(); if new_index < N { self.entries.push(new); @@ -212,7 +212,7 @@ impl OrderedPool { /// /// The element is inserted unconditionally, and the least priority element is returned by /// value. - pub(crate) fn force_insert(&mut self, new: T) -> Option { + pub fn force_insert(&mut self, new: T) -> Option { let new_index = self.entries.len(); if new_index < N { self.entries.push(new);