Struct Capabilities
pub struct Capabilities { /* private fields */ }Expand description
Represents all capabilities of a node.
Implementations§
§impl Capabilities
impl Capabilities
pub fn new(value: Vec<Capability>) -> Capabilities
pub fn new(value: Vec<Capability>) -> Capabilities
Create a new instance from the given vec.
pub const fn supports_eth_at_least(&self, version: &EthVersion) -> bool
pub const fn supports_eth_at_least(&self, version: &EthVersion) -> bool
Returns true if this peer advertises an eth protocol version that is >= version.
This is not an exact-match check: a peer advertising only eth/71 will return
true for any of Eth66..=Eth71, because eth versions are additive — a newer version
implies support for the messages of all earlier versions.
Use this to gate requests on a minimum protocol version (e.g. BAL requires eth/71),
not to check whether a peer advertises a specific version verbatim. For exact-version
checks use the supports_eth_vXX helpers (e.g. Self::supports_eth_v71).
pub fn capabilities(&self) -> &[Capability]
pub fn capabilities(&self) -> &[Capability]
Returns all capabilities.
pub fn into_inner(self) -> Vec<Capability>
pub fn into_inner(self) -> Vec<Capability>
Consumes the type and returns the all capabilities.
pub const fn supports_eth(&self) -> bool
pub const fn supports_eth(&self) -> bool
Whether the peer supports eth sub-protocol.
pub const fn supports_eth_v66(&self) -> bool
pub const fn supports_eth_v66(&self) -> bool
Whether this peer supports eth v66 protocol.
pub const fn supports_eth_v67(&self) -> bool
pub const fn supports_eth_v67(&self) -> bool
Whether this peer supports eth v67 protocol.
pub const fn supports_eth_v68(&self) -> bool
pub const fn supports_eth_v68(&self) -> bool
Whether this peer supports eth v68 protocol.
pub const fn supports_eth_v69(&self) -> bool
pub const fn supports_eth_v69(&self) -> bool
Whether this peer supports eth v69 protocol.
pub const fn supports_eth_v70(&self) -> bool
pub const fn supports_eth_v70(&self) -> bool
Whether this peer supports eth v70 protocol.
pub const fn supports_eth_v71(&self) -> bool
pub const fn supports_eth_v71(&self) -> bool
Whether this peer supports eth v71 protocol.
Trait Implementations§
§impl Clone for Capabilities
impl Clone for Capabilities
§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§impl Debug for Capabilities
impl Debug for Capabilities
§impl Decodable for Capabilities
impl Decodable for Capabilities
§fn decode(buf: &mut &[u8]) -> Result<Capabilities, Error>
fn decode(buf: &mut &[u8]) -> Result<Capabilities, Error>
buf must be advanced past
the decoded object.§impl Encodable for Capabilities
impl Encodable for Capabilities
impl Eq for Capabilities
§impl From<Vec<Capability>> for Capabilities
impl From<Vec<Capability>> for Capabilities
§fn from(value: Vec<Capability>) -> Capabilities
fn from(value: Vec<Capability>) -> Capabilities
§impl PartialEq for Capabilities
impl PartialEq for Capabilities
impl StructuralPartialEq for Capabilities
Auto Trait Implementations§
impl Freeze for Capabilities
impl RefUnwindSafe for Capabilities
impl Send for Capabilities
impl Sync for Capabilities
impl Unpin for Capabilities
impl UnsafeUnpin for Capabilities
impl UnwindSafe for Capabilities
Blanket Implementations§
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
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes