Struct git_transport::client::Capabilities
source · [−]pub struct Capabilities { /* private fields */ }
Expand description
A structure to represent multiple capabilities or features supported by the server.
Implementations
sourceimpl Capabilities
impl Capabilities
sourcepub fn from_lines_with_version_detection<T: Read>(
rd: &mut StreamingPeekableIter<T>
) -> Result<Outcome<'_>, Error>
pub fn from_lines_with_version_detection<T: Read>(
rd: &mut StreamingPeekableIter<T>
) -> Result<Outcome<'_>, Error>
Read the capabilities and version advertisement from the given packetline reader.
If Protocol::V1
was requested, or the remote decided to downgrade, the remote refs
advertisement will also be included in the Outcome
.
sourceimpl Capabilities
impl Capabilities
sourcepub fn from_bytes(bytes: &[u8]) -> Result<(Capabilities, usize), Error>
pub fn from_bytes(bytes: &[u8]) -> Result<(Capabilities, usize), Error>
Parse capabilities from the given bytes
.
Useful in case they are encoded within a ref
behind a null byte.
sourcepub fn from_lines(
first_line: Option<impl Into<Result<String>>>,
remaining_lines: impl Into<String>
) -> Result<Capabilities, Error>
pub fn from_lines(
first_line: Option<impl Into<Result<String>>>,
remaining_lines: impl Into<String>
) -> Result<Capabilities, Error>
Parse capabilities from the given a first_line
and the rest of the lines as single newline
separated string via remaining_lines
.
Useful for parsing capabilities from a data sent from a server, and to avoid having to deal with blocking and async traits for as long as possible. There is no value in parsing a few bytes in a non-blocking fashion.
sourcepub fn contains(&self, feature: &str) -> bool
pub fn contains(&self, feature: &str) -> bool
Returns true of the given feature
is mentioned in this list of capabilities.
sourcepub fn capability(&self, name: &str) -> Option<Capability<'_>>
pub fn capability(&self, name: &str) -> Option<Capability<'_>>
Returns the capability with name
.
sourcepub fn iter(&self) -> impl Iterator<Item = Capability<'_>>
pub fn iter(&self) -> impl Iterator<Item = Capability<'_>>
Returns an iterator over all capabilities.
Trait Implementations
sourceimpl Clone for Capabilities
impl Clone for Capabilities
sourcefn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for Capabilities
impl Send for Capabilities
impl Sync for Capabilities
impl Unpin for Capabilities
impl UnwindSafe for Capabilities
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more