Struct git_ref::PartialName
source · pub struct PartialName(_);
Expand description
A validated complete and fully qualified owned reference name, safe to use for all operations.
Implementations§
source§impl PartialName
impl PartialName
sourcepub fn join(self, component: impl AsRef<[u8]>) -> Result<Self, Error>
pub fn join(self, component: impl AsRef<[u8]>) -> Result<Self, Error>
Append the component
to ourselves and validate the newly created partial path.
Examples found in repository?
src/store/file/find.rs (line 94)
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
pub(crate) fn find_one_with_verified_input(
&self,
partial_name: &PartialNameRef,
packed: Option<&packed::Buffer>,
) -> Result<Option<Reference>, Error> {
let mut buf = BString::default();
if partial_name.looks_like_full_name() {
if let Some(r) = self.find_inner("", partial_name, None, Transform::None, &mut buf)? {
return Ok(Some(r));
}
}
for inbetween in &["", "tags", "heads", "remotes"] {
match self.find_inner(inbetween, partial_name, packed, Transform::EnforceRefsPrefix, &mut buf) {
Ok(Some(r)) => return Ok(Some(r)),
Ok(None) => {
continue;
}
Err(err) => return Err(err),
}
}
self.find_inner(
"remotes",
partial_name
.to_owned()
.join("HEAD")
.expect("HEAD is valid name")
.as_ref(),
None,
Transform::EnforceRefsPrefix,
&mut buf,
)
}
Trait Implementations§
source§impl AsRef<PartialNameRef> for PartialName
impl AsRef<PartialNameRef> for PartialName
source§fn as_ref(&self) -> &PartialNameRef
fn as_ref(&self) -> &PartialNameRef
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Borrow<PartialNameRef> for PartialName
impl Borrow<PartialNameRef> for PartialName
source§fn borrow(&self) -> &PartialNameRef
fn borrow(&self) -> &PartialNameRef
Immutably borrows from an owned value. Read more
source§impl Debug for PartialName
impl Debug for PartialName
source§impl Hash for PartialName
impl Hash for PartialName
source§impl Ord for PartialName
impl Ord for PartialName
source§fn cmp(&self, other: &PartialName) -> Ordering
fn cmp(&self, other: &PartialName) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<PartialName> for PartialName
impl PartialEq<PartialName> for PartialName
source§fn eq(&self, other: &PartialName) -> bool
fn eq(&self, other: &PartialName) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<PartialName> for PartialName
impl PartialOrd<PartialName> for PartialName
source§fn partial_cmp(&self, other: &PartialName) -> Option<Ordering>
fn partial_cmp(&self, other: &PartialName) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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