pub struct Capabilities { /* private fields */ }
Expand description

A structure to represent multiple capabilities or features supported by the server.

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

source§

fn default() -> Capabilities

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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