Struct View

Source
pub struct View { /* private fields */ }
Expand description

A wrapper around op_store::View that defines additional methods.

Implementations§

Source§

impl View

Source

pub fn new(op_store_view: View) -> Self

Source

pub fn wc_commit_ids(&self) -> &BTreeMap<WorkspaceNameBuf, CommitId>

Source

pub fn get_wc_commit_id(&self, name: &WorkspaceName) -> Option<&CommitId>

Source

pub fn workspaces_for_wc_commit_id( &self, commit_id: &CommitId, ) -> Vec<WorkspaceNameBuf>

Source

pub fn is_wc_commit_id(&self, commit_id: &CommitId) -> bool

Source

pub fn heads(&self) -> &HashSet<CommitId>

Source

pub fn bookmarks(&self) -> impl Iterator<Item = (&RefName, BookmarkTarget<'_>)>

Iterates pair of local and remote bookmarks by bookmark name.

Source

pub fn tags(&self) -> &BTreeMap<RefNameBuf, RefTarget>

Source

pub fn git_refs(&self) -> &BTreeMap<GitRefNameBuf, RefTarget>

Source

pub fn git_head(&self) -> &RefTarget

Source

pub fn set_wc_commit(&mut self, name: WorkspaceNameBuf, commit_id: CommitId)

Source

pub fn remove_wc_commit(&mut self, name: &WorkspaceName)

Source

pub fn rename_workspace( &mut self, old_name: &WorkspaceName, new_name: WorkspaceNameBuf, ) -> Result<(), RenameWorkspaceError>

Source

pub fn add_head(&mut self, head_id: &CommitId)

Source

pub fn remove_head(&mut self, head_id: &CommitId)

Source

pub fn local_bookmarks(&self) -> impl Iterator<Item = (&RefName, &RefTarget)>

Iterates local bookmark (name, target)s in lexicographical order.

Source

pub fn local_bookmarks_for_commit<'a, 'b>( &'a self, commit_id: &'b CommitId, ) -> impl Iterator<Item = (&'a RefName, &'a RefTarget)> + use<'a, 'b>

Iterates local bookmarks (name, target) in lexicographical order where the target adds commit_id.

Source

pub fn local_bookmarks_matching<'a, 'b>( &'a self, pattern: &'b StringPattern, ) -> impl Iterator<Item = (&'a RefName, &'a RefTarget)> + use<'a, 'b>

Iterates local bookmark (name, target)s matching the given pattern. Entries are sorted by name.

Source

pub fn get_local_bookmark(&self, name: &RefName) -> &RefTarget

Source

pub fn set_local_bookmark_target(&mut self, name: &RefName, target: RefTarget)

Sets local bookmark to point to the given target. If the target is absent, and if no associated remote bookmarks exist, the bookmark will be removed.

Source

pub fn all_remote_bookmarks( &self, ) -> impl Iterator<Item = (RemoteRefSymbol<'_>, &RemoteRef)>

Iterates over (symbol, remote_ref) for all remote bookmarks in lexicographical order.

Source

pub fn remote_bookmarks( &self, remote_name: &RemoteName, ) -> impl Iterator<Item = (&RefName, &RemoteRef)> + use<'_>

Iterates over (name, remote_ref)s for all remote bookmarks of the specified remote in lexicographical order.

Source

pub fn remote_bookmarks_matching<'a, 'b>( &'a self, bookmark_pattern: &'b StringPattern, remote_pattern: &'b StringPattern, ) -> impl Iterator<Item = (RemoteRefSymbol<'a>, &'a RemoteRef)> + use<'a, 'b>

Iterates over (symbol, remote_ref)s for all remote bookmarks of the specified remote that match the given pattern.

Entries are sorted by symbol, which is (name, remote).

Source

pub fn get_remote_bookmark(&self, symbol: RemoteRefSymbol<'_>) -> &RemoteRef

Source

pub fn set_remote_bookmark( &mut self, symbol: RemoteRefSymbol<'_>, remote_ref: RemoteRef, )

Sets remote-tracking bookmark to the given target and state. If the target is absent, the bookmark will be removed.

Source

pub fn local_remote_bookmarks( &self, remote_name: &RemoteName, ) -> impl Iterator<Item = (&RefName, LocalAndRemoteRef<'_>)> + use<'_>

Iterates over (name, {local_ref, remote_ref})s for every bookmark present locally and/or on the specified remote, in lexicographical order.

Note that this does not take into account whether the local bookmark tracks the remote bookmark or not. Missing values are represented as RefTarget::absent_ref() or RemoteRef::absent_ref().

Source

pub fn local_remote_bookmarks_matching<'a, 'b>( &'a self, bookmark_pattern: &'b StringPattern, remote_name: &RemoteName, ) -> impl Iterator<Item = (&'a RefName, LocalAndRemoteRef<'a>)> + use<'a, 'b>

Iterates over (name, TrackingRefPair {local_ref, remote_ref})s for every bookmark with a name that matches the given pattern, and that is present locally and/or on the specified remote.

Entries are sorted by name.

Note that this does not take into account whether the local bookmark tracks the remote bookmark or not. Missing values are represented as RefTarget::absent_ref() or RemoteRef::absent_ref().

Source

pub fn remove_remote(&mut self, remote_name: &RemoteName)

Source

pub fn rename_remote(&mut self, old: &RemoteName, new: &RemoteName)

Source

pub fn get_tag(&self, name: &RefName) -> &RefTarget

Source

pub fn tags_matching<'a, 'b>( &'a self, pattern: &'b StringPattern, ) -> impl Iterator<Item = (&'a RefName, &'a RefTarget)> + use<'a, 'b>

Iterates tags (name, target)s matching the given pattern. Entries are sorted by name.

Source

pub fn set_tag_target(&mut self, name: &RefName, target: RefTarget)

Sets tag to point to the given target. If the target is absent, the tag will be removed.

Source

pub fn get_git_ref(&self, name: &GitRefName) -> &RefTarget

Source

pub fn set_git_ref_target(&mut self, name: &GitRefName, target: RefTarget)

Sets the last imported Git ref to point to the given target. If the target is absent, the reference will be removed.

Source

pub fn set_git_head_target(&mut self, target: RefTarget)

Sets Git HEAD to point to the given target. If the target is absent, the reference will be cleared.

Source

pub fn all_referenced_commit_ids(&self) -> impl Iterator<Item = &CommitId>

Iterates all commit ids referenced by this view.

This can include hidden commits referenced by remote bookmarks, previous positions of conflicted bookmarks, etc. The ancestors and predecessors of the returned commits should be considered reachable from the view. Use this to build commit index from scratch.

The iteration order is unspecified, and may include duplicated entries.

Source

pub fn set_view(&mut self, data: View)

Source

pub fn store_view(&self) -> &View

Source

pub fn store_view_mut(&mut self) -> &mut View

Trait Implementations§

Source§

impl Clone for View

Source§

fn clone(&self) -> View

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for View

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for View

Source§

fn eq(&self, other: &View) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for View

Source§

impl StructuralPartialEq for View

Auto Trait Implementations§

§

impl Freeze for View

§

impl RefUnwindSafe for View

§

impl Send for View

§

impl Sync for View

§

impl Unpin for View

§

impl UnwindSafe for View

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,