Struct git_ref::FullNameRef

source ·
#[repr(transparent)]
pub struct FullNameRef(_);
Expand description

A validated and potentially partial reference name - it can safely be used for common operations.

Implementations§

source§

impl FullNameRef

source

pub fn as_partial_name(&self) -> &PartialNameRef

Interpret this fully qualified reference name as partial name.

source

pub fn to_path(&self) -> &Path

Convert this name into the relative path identifying the reference location.

source

pub fn as_bstr(&self) -> &BStr

Return ourselves as byte string which is a valid refname

source

pub fn shorten(&self) -> &BStr

Strip well-known prefixes from the name and return it.

If there is no such prefix, the original name is returned.

source

pub fn category(&self) -> Option<Category<'_>>

Classify this name, or return None if it’s unclassified.

source

pub fn category_and_short_name(&self) -> Option<(Category<'_>, &BStr)>

Classify this name, or return None if it’s unclassified. If Some, the shortened name is returned as well.

source§

impl FullNameRef

source

pub fn file_name(&self) -> &BStr

Return the file name portion of a full name, for instance main if the full name was refs/heads/main.

Trait Implementations§

source§

impl AsRef<FullNameRef> for FullName

source§

fn as_ref(&self) -> &FullNameRef

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<FullNameRef> for FullName

source§

fn borrow(&self) -> &FullNameRef

Immutably borrows from an owned value. Read more
source§

impl Debug for FullNameRef

source§

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

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

impl<'a> From<&'a FullNameRef> for &'a BStr

source§

fn from(name: &'a FullNameRef) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a FullNameRef> for &'a PartialNameRef

source§

fn from(v: &'a FullNameRef) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a FullNameRef> for FullName

source§

fn from(value: &'a FullNameRef) -> Self

Converts to this type from the input type.
source§

impl Hash for FullNameRef

source§

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

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

impl Ord for FullNameRef

source§

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

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

impl PartialEq<FullNameRef> for FullNameRef

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<FullNameRef> for FullNameRef

source§

fn partial_cmp(&self, other: &FullNameRef) -> 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

This method 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

This method 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

This method 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

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

impl ToOwned for FullNameRef

§

type Owned = FullName

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'a> TryFrom<&'a BStr> for &'a FullNameRef

§

type Error = Error

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

fn try_from(v: &'a BStr) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a String> for &'a FullNameRef

§

type Error = Error

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

fn try_from(v: &'a String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<&'a str> for &'a FullNameRef

§

type Error = Error

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

fn try_from(v: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for FullNameRef

source§

impl StructuralEq for FullNameRef

source§

impl StructuralPartialEq for FullNameRef

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more