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:
| Field | Platform / Feature |
|---|---|
supports_sendmsg_x, supports_recvmsg_x | target_os = "macos" |
supports_wsa_send_msg, supports_wsa_recv_msg | target_os = "windows" |
supports_timestamping | feature = "timestamping" |
supports_pktinfo | feature = "pktinfo" |
§Example
use binger_udp::platform_capabilities;
let caps = platform_capabilities();
println!("Backend: {}", caps.backend_name);Fields§
§supports_sendmmsg: boolWhether sendmmsg is available (Linux only).
supports_recvmmsg: boolWhether recvmmsg is available (Linux only).
supports_gso: boolWhether Generic Segmentation Offload (GSO) is available (Linux, requires gso feature).
supports_gro: boolWhether Generic Receive Offload (GRO) is available (Linux, requires gro feature).
supports_busy_poll: boolWhether SO_BUSY_POLL is available (Linux, requires busy-poll feature).
supports_pacing: boolWhether SO_MAX_PACING_RATE is available (Linux, requires pacing feature).
max_batch_size: usizeMaximum batch size supported by the backend.
Linux backends typically support up to 1024; other platforms up to 32.
backend_name: &'static strHuman-readable name of the active backend.
Examples: "sendmmsg/recvmmsg (Linux)", "fallback (loop sendto/recvfrom)".