pub struct GitBranchName(/* private fields */);Expand description
A validated branch name.
Implementations§
Source§impl GitBranchName
impl GitBranchName
Sourcepub fn new(value: impl AsRef<str>) -> Result<GitBranchName, GitBranchNameError>
pub fn new(value: impl AsRef<str>) -> Result<GitBranchName, GitBranchNameError>
Creates a branch name from text.
§Errors
Returns GitBranchNameError when the branch name is empty or invalid.
Sourcepub fn is_mainline(&self) -> bool
pub fn is_mainline(&self) -> bool
Returns true for common mainline names.
Sourcepub fn is_feature(&self) -> bool
pub fn is_feature(&self) -> bool
Returns true for feature branch spellings.
Sourcepub fn is_release(&self) -> bool
pub fn is_release(&self) -> bool
Returns true for release branch spellings.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the branch name and returns owned text.
Trait Implementations§
Source§impl AsRef<str> for GitBranchName
impl AsRef<str> for GitBranchName
Source§impl Clone for GitBranchName
impl Clone for GitBranchName
Source§fn clone(&self) -> GitBranchName
fn clone(&self) -> GitBranchName
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GitBranchName
impl Debug for GitBranchName
Source§impl Display for GitBranchName
impl Display for GitBranchName
Source§impl FromStr for GitBranchName
impl FromStr for GitBranchName
Source§type Err = GitBranchNameError
type Err = GitBranchNameError
The associated error which can be returned from parsing.
Source§fn from_str(
value: &str,
) -> Result<GitBranchName, <GitBranchName as FromStr>::Err>
fn from_str( value: &str, ) -> Result<GitBranchName, <GitBranchName as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for GitBranchName
impl Hash for GitBranchName
Source§impl Ord for GitBranchName
impl Ord for GitBranchName
Source§fn cmp(&self, other: &GitBranchName) -> Ordering
fn cmp(&self, other: &GitBranchName) -> Ordering
1.21.0 (const: unstable) · 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 for GitBranchName
impl PartialEq for GitBranchName
Source§fn eq(&self, other: &GitBranchName) -> bool
fn eq(&self, other: &GitBranchName) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for GitBranchName
impl PartialOrd for GitBranchName
Source§impl TryFrom<&str> for GitBranchName
impl TryFrom<&str> for GitBranchName
Source§type Error = GitBranchNameError
type Error = GitBranchNameError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &str,
) -> Result<GitBranchName, <GitBranchName as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<GitBranchName, <GitBranchName as TryFrom<&str>>::Error>
Performs the conversion.
impl Eq for GitBranchName
impl StructuralPartialEq for GitBranchName
Auto Trait Implementations§
impl Freeze for GitBranchName
impl RefUnwindSafe for GitBranchName
impl Send for GitBranchName
impl Sync for GitBranchName
impl Unpin for GitBranchName
impl UnsafeUnpin for GitBranchName
impl UnwindSafe for GitBranchName
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