pub struct GitRefspec { /* private fields */ }Expand description
A lightweight refspec model.
Implementations§
Source§impl GitRefspec
impl GitRefspec
Sourcepub const fn new(
source: RefspecSource,
destination: Option<RefspecDestination>,
direction: RefspecDirection,
mode: RefspecMode,
) -> GitRefspec
pub const fn new( source: RefspecSource, destination: Option<RefspecDestination>, direction: RefspecDirection, mode: RefspecMode, ) -> GitRefspec
Creates a refspec from parts.
Sourcepub fn parse(value: impl AsRef<str>) -> Result<GitRefspec, RefspecParseError>
pub fn parse(value: impl AsRef<str>) -> Result<GitRefspec, RefspecParseError>
Parses a fetch-oriented refspec from text.
§Errors
Returns RefspecParseError when the refspec is empty or malformed.
Sourcepub fn parse_with_direction(
value: impl AsRef<str>,
direction: RefspecDirection,
) -> Result<GitRefspec, RefspecParseError>
pub fn parse_with_direction( value: impl AsRef<str>, direction: RefspecDirection, ) -> Result<GitRefspec, RefspecParseError>
Parses a refspec from text with explicit direction vocabulary.
§Errors
Returns RefspecParseError when the refspec is empty or malformed.
Sourcepub const fn source(&self) -> &RefspecSource
pub const fn source(&self) -> &RefspecSource
Returns the source side.
Sourcepub const fn destination(&self) -> Option<&RefspecDestination>
pub const fn destination(&self) -> Option<&RefspecDestination>
Returns the destination side when present.
Sourcepub const fn direction(&self) -> RefspecDirection
pub const fn direction(&self) -> RefspecDirection
Returns the direction vocabulary.
Sourcepub const fn mode(&self) -> RefspecMode
pub const fn mode(&self) -> RefspecMode
Returns the force mode vocabulary.
Sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Returns true when either side contains *.
Trait Implementations§
Source§impl Clone for GitRefspec
impl Clone for GitRefspec
Source§fn clone(&self) -> GitRefspec
fn clone(&self) -> GitRefspec
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 GitRefspec
impl Debug for GitRefspec
Source§impl Display for GitRefspec
impl Display for GitRefspec
Source§impl FromStr for GitRefspec
impl FromStr for GitRefspec
Source§type Err = RefspecParseError
type Err = RefspecParseError
The associated error which can be returned from parsing.
Source§fn from_str(value: &str) -> Result<GitRefspec, <GitRefspec as FromStr>::Err>
fn from_str(value: &str) -> Result<GitRefspec, <GitRefspec as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl PartialEq for GitRefspec
impl PartialEq for GitRefspec
Source§fn eq(&self, other: &GitRefspec) -> bool
fn eq(&self, other: &GitRefspec) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for GitRefspec
impl StructuralPartialEq for GitRefspec
Auto Trait Implementations§
impl Freeze for GitRefspec
impl RefUnwindSafe for GitRefspec
impl Send for GitRefspec
impl Sync for GitRefspec
impl Unpin for GitRefspec
impl UnsafeUnpin for GitRefspec
impl UnwindSafe for GitRefspec
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