Skip to main content

PlatformCaps

Struct PlatformCaps 

Source
pub struct PlatformCaps {
    pub supports_sendmmsg: bool,
    pub supports_recvmmsg: bool,
    pub supports_gso: bool,
    pub supports_gro: bool,
    pub supports_busy_poll: bool,
    pub supports_pacing: bool,
    pub max_batch_size: usize,
    pub backend_name: &'static str,
}
Expand description

Reports which platform-optimized syscalls and features are available at compile time.

PlatformCaps is obtained via platform_capabilities() or BingerUdp::capabilities(). Use it to dynamically select code paths or to log which backend is active.

Some fields are conditionally compiled:

FieldPlatform / Feature
supports_sendmsg_x, supports_recvmsg_xtarget_os = "macos"
supports_wsa_send_msg, supports_wsa_recv_msgtarget_os = "windows"
supports_timestampingfeature = "timestamping"
supports_pktinfofeature = "pktinfo"

§Example

use binger_udp::platform_capabilities;

let caps = platform_capabilities();
println!("Backend: {}", caps.backend_name);

Fields§

§supports_sendmmsg: bool

Whether sendmmsg is available (Linux only).

§supports_recvmmsg: bool

Whether recvmmsg is available (Linux only).

§supports_gso: bool

Whether Generic Segmentation Offload (GSO) is available (Linux, requires gso feature).

§supports_gro: bool

Whether Generic Receive Offload (GRO) is available (Linux, requires gro feature).

§supports_busy_poll: bool

Whether SO_BUSY_POLL is available (Linux, requires busy-poll feature).

§supports_pacing: bool

Whether SO_MAX_PACING_RATE is available (Linux, requires pacing feature).

§max_batch_size: usize

Maximum batch size supported by the backend.

Linux backends typically support up to 1024; other platforms up to 32.

§backend_name: &'static str

Human-readable name of the active backend.

Examples: "sendmmsg/recvmmsg (Linux)", "fallback (loop sendto/recvfrom)".

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> 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, 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.