gix_ref

Struct FullNameRef

Source
pub struct FullNameRef(/* private fields */);
Expand description

A validated complete and fully qualified reference name, safe to use for all 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 for FullNameRef

Source§

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

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 ToOwned for FullNameRef

Source§

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

Source§

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

Source§

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

Source§

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 StructuralPartialEq for FullNameRef

Auto Trait Implementations§

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