pub struct Cursor<'id, 's, 'a, T: Flat, Root: Flat, B: Buf> { /* private fields */ }Expand description
Chainable cursor over a Session.
Provides a fluent API for navigating and mutating a region. Each method
consumes self (by move), preventing borrow conflicts. For complex
navigation patterns or batch operations, use Session methods directly.
use nearest::{Flat, Near, Region, near};
#[derive(Flat, Debug)]
struct Outer { inner: Near<Inner> }
#[derive(Flat, Debug, Clone, Copy)]
struct Inner { value: u32 }
let mut region = Region::new(Outer::make(near(Inner { value: 1 })));
assert_eq!(region.inner.get().value, 1);
region.session(|s| {
s.cursor()
.at(|root| &root.inner) // navigate to inner Near<Inner>
.follow() // dereference the Near pointer
.set(Inner { value: 42 }); // overwrite
});
assert_eq!(region.inner.get().value, 42);Implementations§
Source§impl<T: Flat, Root: Flat, B: Buf> Cursor<'_, '_, '_, T, Root, B>
impl<T: Flat, Root: Flat, B: Buf> Cursor<'_, '_, '_, T, Root, B>
Sourcepub fn write_with(self, builder: impl Emit<T>)
pub fn write_with(self, builder: impl Emit<T>)
Overwrite the value at this cursor’s position using a builder.
Auto Trait Implementations§
impl<'id, 's, 'a, T, Root, B> Freeze for Cursor<'id, 's, 'a, T, Root, B>
impl<'id, 's, 'a, T, Root, B> RefUnwindSafe for Cursor<'id, 's, 'a, T, Root, B>
impl<'id, 's, 'a, T, Root, B> Send for Cursor<'id, 's, 'a, T, Root, B>
impl<'id, 's, 'a, T, Root, B> Sync for Cursor<'id, 's, 'a, T, Root, B>
impl<'id, 's, 'a, T, Root, B> Unpin for Cursor<'id, 's, 'a, T, Root, B>where
T: Unpin,
impl<'id, 's, 'a, T, Root, B> UnsafeUnpin for Cursor<'id, 's, 'a, T, Root, B>
impl<'id, 's, 'a, T, Root, B> !UnwindSafe for Cursor<'id, 's, 'a, T, Root, B>
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