Skip to content

Commit

Permalink
refactor: prevent 'FreeRegionIter' from being exposed
Browse files Browse the repository at this point in the history
  • Loading branch information
darfink committed Jun 10, 2019
1 parent 7ff857d commit e5124e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/alloc/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::error::{Error, Result};
use std::ops::Range;

/// Returns an iterator for free after the specified address.
pub fn after(origin: *const (), range: Option<Range<usize>>) -> FreeRegionIter {
pub fn after(origin: *const (), range: Option<Range<usize>>) -> impl Iterator<Item = Result<*const ()>> {
FreeRegionIter::new(origin, range, SearchDirection::After)
}

/// Returns an iterator for free before the specified address.
pub fn before(origin: *const (), range: Option<Range<usize>>) -> FreeRegionIter {
pub fn before(origin: *const (), range: Option<Range<usize>>) -> impl Iterator<Item = Result<*const ()>> {
FreeRegionIter::new(origin, range, SearchDirection::Before)
}

Expand All @@ -18,7 +18,7 @@ enum SearchDirection {
}

/// An iterator searching for free regions.
pub struct FreeRegionIter {
struct FreeRegionIter {
range: Range<usize>,
search: SearchDirection,
current: usize,
Expand Down

0 comments on commit e5124e1

Please sign in to comment.