Struct gitoxide_core::pack::receive::Capabilities
source · pub struct Capabilities { /* private fields */ }async-client or blocking-client only.Expand description
A structure to represent multiple capabilities or features supported by the server.
Implementations§
source§impl 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(lines_buf: BString) -> Result<Capabilities, Error>
pub fn from_lines(lines_buf: BString) -> Result<Capabilities, Error>
Parse capabilities from the given a lines_buf which is expected to be all newline separated lines
from the server.
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.
impl Capabilities
internal use
source§impl Capabilities
impl Capabilities
sourcepub fn from_lines_with_version_detection<T>(
rd: &mut StreamingPeekableIter<T>
) -> Result<Outcome<'_>, Error>where
T: Read,
pub fn from_lines_with_version_detection<T>( rd: &mut StreamingPeekableIter<T> ) -> Result<Outcome<'_>, Error>where T: Read,
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.
Trait Implementations§
source§impl Clone for Capabilities
impl Clone for Capabilities
source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more