gix_transport::client

Struct Capabilities

source
pub struct Capabilities { /* private fields */ }
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

source

pub fn from_lines_with_version_detection<T: Read>( rd: &mut StreamingPeekableIter<T>, ) -> Result<Outcome<'_>, Error>

Available on crate feature blocking-client only.

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.

source§

impl Capabilities

source

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.

source

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.

source

pub fn contains(&self, feature: &str) -> bool

Returns true of the given feature is mentioned in this list of capabilities.

source

pub fn capability(&self, name: &str) -> Option<Capability<'_>>

Returns the capability with name.

source

pub fn iter(&self) -> impl Iterator<Item = Capability<'_>>

Returns an iterator over all capabilities.

Trait Implementations§

source§

impl Clone for Capabilities

source§

fn clone(&self) -> Capabilities

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Capabilities

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Capabilities

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Capabilities

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,