pub struct MaState<'tree, T: ForeignOwnable> { /* private fields */ }
Expand description
Implementations§
Source§impl<'tree, T: ForeignOwnable> MaState<'tree, T>
impl<'tree, T: ForeignOwnable> MaState<'tree, T>
Sourcepub fn find(&mut self, max: usize) -> Option<T::BorrowedMut<'_>>
pub fn find(&mut self, max: usize) -> Option<T::BorrowedMut<'_>>
Find the next entry in the maple tree.
§Examples
Iterate the maple tree.
use kernel::maple_tree::MapleTree;
use kernel::sync::Arc;
let tree = KBox::pin_init(MapleTree::<Arc<i32>>::new(), GFP_KERNEL)?;
let ten = Arc::new(10, GFP_KERNEL)?;
let twenty = Arc::new(20, GFP_KERNEL)?;
tree.insert(100, ten, GFP_KERNEL)?;
tree.insert(200, twenty, GFP_KERNEL)?;
let mut ma_lock = tree.lock();
let mut iter = ma_lock.ma_state(0, usize::MAX);
assert_eq!(iter.find(usize::MAX).map(|v| *v), Some(10));
assert_eq!(iter.find(usize::MAX).map(|v| *v), Some(20));
assert!(iter.find(usize::MAX).is_none());
Auto Trait Implementations§
impl<'tree, T> Freeze for MaState<'tree, T>
impl<'tree, T> !RefUnwindSafe for MaState<'tree, T>
impl<'tree, T> !Send for MaState<'tree, T>
impl<'tree, T> !Sync for MaState<'tree, T>
impl<'tree, T> Unpin for MaState<'tree, T>
impl<'tree, T> !UnwindSafe for MaState<'tree, T>
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> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot
. Read more