pub struct Capabilities(/* private fields */);Expand description
A space-separated capability list, kept as raw strings.
Not a bitfield: agent=… and object-format=… carry values, unknown
capabilities must survive round-tripping for diagnostics, and the set grows
with every git release. A server that dropped what it did not recognise
would report a peer’s capabilities as smaller than they were.
Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub fn parse(raw: &str) -> Self
pub fn parse(raw: &str) -> Self
Parse a space-separated capability list.
Empty items are dropped. git’s own receive-pack client emits
…\0 report-status-v2 … with a leading space, which a naive
split(' ') turns into a phantom capability with an empty name.
Sourcepub fn parse_bytes(raw: &[u8]) -> Result<Self>
pub fn parse_bytes(raw: &[u8]) -> Result<Self>
Parse from bytes, refusing a list that is not UTF-8.
Reference names are bytes (see crate::command); capability names
are not — every one git defines is ASCII, and a non-ASCII one would be a
peer this grammar has no way to satisfy.
Sourcepub fn from_items<S: Into<String>>(items: impl IntoIterator<Item = S>) -> Self
pub fn from_items<S: Into<String>>(items: impl IntoIterator<Item = S>) -> Self
Build from an ordered list.
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more