Struct Capabilities

Source
pub struct Capabilities { /* private fields */ }
Available on crate features 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

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.

Source§

impl Capabilities

This impl block contains no items.

internal use

Source§

impl Capabilities

Source

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

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<(), Error>

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

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

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

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Capabilities, <__D as Deserializer<'de>>::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 as Serializer>::Ok, <__S as Serializer>::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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T