Struct git2::Refspec

source ·
pub struct Refspec<'remote> { /* private fields */ }
Expand description

A structure to represent a git refspec.

Refspecs are currently mainly accessed/created through a Remote.

Implementations§

source§

impl<'remote> Refspec<'remote>

source

pub fn direction(&self) -> Direction

Get the refspec’s direction.

source

pub fn dst(&self) -> Option<&str>

Get the destination specifier.

If the destination is not utf-8, None is returned.

source

pub fn dst_bytes(&self) -> &[u8]

Get the destination specifier, in bytes.

source

pub fn dst_matches(&self, refname: &str) -> bool

Check if a refspec’s destination descriptor matches a reference

source

pub fn src(&self) -> Option<&str>

Get the source specifier.

If the source is not utf-8, None is returned.

source

pub fn src_bytes(&self) -> &[u8]

Get the source specifier, in bytes.

source

pub fn src_matches(&self, refname: &str) -> bool

Check if a refspec’s source descriptor matches a reference

source

pub fn is_force(&self) -> bool

Get the force update setting.

source

pub fn str(&self) -> Option<&str>

Get the refspec’s string.

Returns None if the string is not valid utf8.

source

pub fn bytes(&self) -> &[u8]

Get the refspec’s string as a byte array

source

pub fn transform(&self, name: &str) -> Result<Buf, Error>

Transform a reference to its target following the refspec’s rules

source

pub fn rtransform(&self, name: &str) -> Result<Buf, Error>

Transform a target reference to its source reference following the refspec’s rules

Auto Trait Implementations§

§

impl<'remote> Freeze for Refspec<'remote>

§

impl<'remote> RefUnwindSafe for Refspec<'remote>

§

impl<'remote> !Send for Refspec<'remote>

§

impl<'remote> !Sync for Refspec<'remote>

§

impl<'remote> Unpin for Refspec<'remote>

§

impl<'remote> UnwindSafe for Refspec<'remote>

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

§

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.
source§

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

source§

impl<T> MaybeSendSync for T