pub struct BfsPool;Expand description
Pool for BFS memory allocation
Provides thread-local pools for reusing BFS data structures.
Implementations§
Source§impl BfsPool
impl BfsPool
Sourcepub fn acquire(expected_size: usize) -> BfsResources
pub fn acquire(expected_size: usize) -> BfsResources
Acquire BFS resources from the pool
§Arguments
expected_size- Expected number of vertices to visit
§Returns
BfsResources that will be returned to the pool when dropped
§Example
use ruvector_mincut::pool::BfsPool;
let mut res = BfsPool::acquire(100);
// Perform BFS
res.queue.push_back(0);
while let Some(v) = res.queue.pop_front() {
if res.visited.insert(v) {
res.results.push(v);
// Push neighbors...
}
}
// Resources automatically returned when res is droppedAuto Trait Implementations§
impl Freeze for BfsPool
impl RefUnwindSafe for BfsPool
impl Send for BfsPool
impl Sync for BfsPool
impl Unpin for BfsPool
impl UnwindSafe for BfsPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more