gix_object::tree::editor

Struct Cursor

Source
pub struct Cursor<'a, 'find> { /* private fields */ }
Expand description

A way to constrain all tree-edits to a given subtree.

Implementations§

Source§

impl Cursor<'_, '_>

Source

pub fn get<I, C>(&self, rela_path: I) -> Option<&Entry>
where I: IntoIterator<Item = C>, C: AsRef<BStr>,

Obtain the entry at rela_path or return None if none was found, or the tree wasn’t yet written to that point. Note that after writing only the root path remains, all other intermediate trees are removed. The entry can be anything that can be stored in a tree, but may have a null-id if it’s a newly inserted tree. Also, ids of trees might not be accurate as they may have been changed in memory.

Source

pub fn upsert<I, C>( &mut self, rela_path: I, kind: EntryKind, id: ObjectId, ) -> Result<&mut Self, Error>
where I: IntoIterator<Item = C>, C: AsRef<BStr>,

Like Editor::upsert(), but with the constraint of only editing in this cursor’s tree.

Source

pub fn remove<I, C>(&mut self, rela_path: I) -> Result<&mut Self, Error>
where I: IntoIterator<Item = C>, C: AsRef<BStr>,

Like Editor::remove(), but with the constraint of only editing in this cursor’s tree.

Source

pub fn write<E>( &mut self, out: impl FnMut(&Tree) -> Result<ObjectId, E>, ) -> Result<ObjectId, E>

Like Editor::write(), but will write only the subtree of the cursor.

Auto Trait Implementations§

§

impl<'a, 'find> Freeze for Cursor<'a, 'find>

§

impl<'a, 'find> !RefUnwindSafe for Cursor<'a, 'find>

§

impl<'a, 'find> !Send for Cursor<'a, 'find>

§

impl<'a, 'find> !Sync for Cursor<'a, 'find>

§

impl<'a, 'find> Unpin for Cursor<'a, 'find>

§

impl<'a, 'find> !UnwindSafe for Cursor<'a, 'find>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.