pub struct Branch<'a>(pub Cow<'a, str>);
Expand description
The branch name part of a ref. refs/head/master
would be Branch::from("master")
.
Tuple Fields§
§0: Cow<'a, str>
Implementations§
source§impl Branch<'_>
impl Branch<'_>
Takes ownership of non-'static
borrowed data, possibly allocating a
String
to do so.
Convenient representation for types that want to stake ownership of the newtype without exposing a generic lifetime of their own.
pub fn possibly_clone(self) -> Branch<'static>
source§impl<'a> Branch<'a>
impl<'a> Branch<'a>
Returns a copy of itself while guaranteeing zero allocations.
Useful for standard containers that use the Borrow + Hash + Eq
sleight of hand to
permit zero allocation lookups while still owning the underlying data.
pub fn always_borrow(&'a self) -> Self
Trait Implementations§
source§impl<'a> Ord for Branch<'a>
impl<'a> Ord for Branch<'a>
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<'a> PartialOrd for Branch<'a>
impl<'a> PartialOrd for Branch<'a>
impl<'a> Eq for Branch<'a>
impl<'a> StructuralPartialEq for Branch<'a>
Auto Trait Implementations§
impl<'a> Freeze for Branch<'a>
impl<'a> RefUnwindSafe for Branch<'a>
impl<'a> Send for Branch<'a>
impl<'a> Sync for Branch<'a>
impl<'a> Unpin for Branch<'a>
impl<'a> UnwindSafe for Branch<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more