pub struct PeerCapability {
pub name: String,
pub version: CapabilityVersion,
pub required: bool,
pub metadata: HashMap<String, String>,
}Expand description
A single named capability with version and optional metadata key-value pairs.
When required is true, the local peer considers this capability mandatory
for a successful negotiation (subject to the active CapabilityPolicy).
Fields§
§name: StringProtocol identifier, e.g. "bitswap" or "graphsync".
version: CapabilityVersionVersion triple describing the capability’s feature level.
required: boolWhether the local node considers this capability mandatory.
metadata: HashMap<String, String>Arbitrary string key-value pairs (e.g. "max_block_size" → "1048576").
Implementations§
Source§impl PeerCapability
impl PeerCapability
Sourcepub fn required(name: impl Into<String>, version: CapabilityVersion) -> Self
pub fn required(name: impl Into<String>, version: CapabilityVersion) -> Self
Construct a required capability with no metadata.
Sourcepub fn optional(name: impl Into<String>, version: CapabilityVersion) -> Self
pub fn optional(name: impl Into<String>, version: CapabilityVersion) -> Self
Construct an optional capability with no metadata.
Sourcepub fn with_metadata(
name: impl Into<String>,
version: CapabilityVersion,
required: bool,
metadata: HashMap<String, String>,
) -> Self
pub fn with_metadata( name: impl Into<String>, version: CapabilityVersion, required: bool, metadata: HashMap<String, String>, ) -> Self
Construct a capability with metadata.
Trait Implementations§
Source§impl Clone for PeerCapability
impl Clone for PeerCapability
Source§fn clone(&self) -> PeerCapability
fn clone(&self) -> PeerCapability
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PeerCapability
impl Debug for PeerCapability
Source§impl PartialEq for PeerCapability
impl PartialEq for PeerCapability
Source§fn eq(&self, other: &PeerCapability) -> bool
fn eq(&self, other: &PeerCapability) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PeerCapability
Auto Trait Implementations§
impl Freeze for PeerCapability
impl RefUnwindSafe for PeerCapability
impl Send for PeerCapability
impl Sync for PeerCapability
impl Unpin for PeerCapability
impl UnsafeUnpin for PeerCapability
impl UnwindSafe for PeerCapability
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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