Struct gix_refspec::RefSpecRef

source ·
pub struct RefSpecRef<'a> { /* private fields */ }
Expand description

A refspec with references to the memory it was parsed from.

Implementations§

source§

impl<'a> RefSpecRef<'a>

Access

source

pub fn source(&self) -> Option<&BStr>

Return the left-hand side of the spec, typically the source. It takes many different forms so don’t rely on this being a ref name.

It’s not present in case of deletions.

source

pub fn destination(&self) -> Option<&BStr>

Return the right-hand side of the spec, typically the destination. It takes many different forms so don’t rely on this being a ref name.

It’s not present in case of source-only specs.

source

pub fn remote(&self) -> Option<&BStr>

Always returns the remote side, whose actual side in the refspec depends on how it was parsed.

source

pub fn local(&self) -> Option<&BStr>

Always returns the local side, whose actual side in the refspec depends on how it was parsed.

source

pub fn prefix(&self) -> Option<&BStr>

Derive the prefix from the source side of this spec if this is a fetch spec, or the destination side if it is a push spec, if it is possible to do so without ambiguity.

This means it starts with refs/. Note that it won’t contain more than two components, like refs/heads/

source

pub fn expand_prefixes(&self, out: &mut Vec<BString>)

As opposed to prefix(), if the latter is None it will expand to all possible prefixes and place them in out.

Note that only the source side is considered.

source

pub fn instruction(&self) -> Instruction<'a>

Transform the state of the refspec into an instruction making clear what to do with it.

source§

impl RefSpecRef<'_>

Conversion

source

pub fn to_owned(&self) -> RefSpec

Convert this ref into a standalone, owned copy.

source§

impl RefSpecRef<'_>

source

pub fn to_bstring(&self) -> BString

Reproduce ourselves in parseable form.

source

pub fn write_to(&self, out: &mut dyn Write) -> Result<()>

Serialize ourselves in a parseable format to out.

Trait Implementations§

source§

impl<'a> Clone for RefSpecRef<'a>

source§

fn clone(&self) -> RefSpecRef<'a>

Returns a copy 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<'a> Debug for RefSpecRef<'a>

source§

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

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

impl From<RefSpecRef<'_>> for RefSpec

source§

fn from(v: RefSpecRef<'_>) -> Self

Converts to this type from the input type.
source§

impl Hash for RefSpecRef<'_>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for RefSpecRef<'_>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for RefSpecRef<'_>

source§

fn eq(&self, other: &Self) -> 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 PartialOrd for RefSpecRef<'_>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> Copy for RefSpecRef<'a>

source§

impl<'a> Eq for RefSpecRef<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RefSpecRef<'a>

§

impl<'a> RefUnwindSafe for RefSpecRef<'a>

§

impl<'a> Send for RefSpecRef<'a>

§

impl<'a> Sync for RefSpecRef<'a>

§

impl<'a> Unpin for RefSpecRef<'a>

§

impl<'a> UnwindSafe for RefSpecRef<'a>

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.