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.
§Deviation
As a shortcoming, we are unable to parse V1 as emitted from git-upload-pack without a git-daemon or server,
as it will not emit any capabilities for some reason. Only V2 and V0 work in that context.
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 moresource§impl Debug for Capabilities
 
impl Debug for Capabilities
source§impl Default for Capabilities
 
impl Default for Capabilities
This implementation yields exactly those minimal capabilities that are required for gix to work, nothing more and nothing less.
This is a bit of a hack just get tests with Protocol V0 to work, which is a good way to enforce stateful transports.
Of course, V1 would also do that but when calling git-upload-pack directly, it advertises so badly that this is easier to implement.
source§fn default() -> Capabilities
 
fn default() -> Capabilities
source§impl<'de> Deserialize<'de> for Capabilities
 
impl<'de> Deserialize<'de> for Capabilities
source§fn deserialize<__D>(
    __deserializer: __D,
) -> Result<Capabilities, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D,
) -> Result<Capabilities, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
source§impl Serialize for Capabilities
 
impl Serialize for Capabilities
source§fn serialize<__S>(
    &self,
    __serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
 
fn serialize<__S>(
    &self,
    __serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
Auto Trait Implementations§
impl Freeze for Capabilities
impl RefUnwindSafe for Capabilities
impl Send for Capabilities
impl Sync for Capabilities
impl Unpin for Capabilities
impl UnwindSafe for Capabilities
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
source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more