pub struct DiscoveryFrame {
pub kind: FrameKind,
pub node: NodeResources,
}Expand description
Discovery frame with binary encoding and CRC32
Fields§
§kind: FrameKind§node: NodeResourcesImplementations§
Source§impl DiscoveryFrame
impl DiscoveryFrame
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encode discovery frame to bytes.
OPTIMIZATION: Delegates directly to encode_into with a single pre-allocated Vec,
eliminating hand-duplicated payload serialization, avoiding stack allocation of 264 bytes,
and preventing double-copy overhead on discovery frame encoding.
Sourcepub fn encode_into(&self, buf: &mut Vec<u8>) -> usize
pub fn encode_into(&self, buf: &mut Vec<u8>) -> usize
Encode discovery frame into a pre-allocated buffer (zero-copy hot path) Returns the number of bytes written.
Trait Implementations§
Source§impl Clone for DiscoveryFrame
impl Clone for DiscoveryFrame
Auto Trait Implementations§
impl Freeze for DiscoveryFrame
impl RefUnwindSafe for DiscoveryFrame
impl Send for DiscoveryFrame
impl Sync for DiscoveryFrame
impl Unpin for DiscoveryFrame
impl UnsafeUnpin for DiscoveryFrame
impl UnwindSafe for DiscoveryFrame
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
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