pub struct Socket { /* private fields */ }
Expand description
An AF_XDP socket.
More details can be found in the docs
Implementations
sourceimpl Socket
impl Socket
sourcepub fn new(
config: SocketConfig,
umem: &Umem,
if_name: &Interface,
queue_id: u32
) -> Result<(TxQueue, RxQueue, Option<(FillQueue, CompQueue)>), SocketCreateError>
pub fn new(
config: SocketConfig,
umem: &Umem,
if_name: &Interface,
queue_id: u32
) -> Result<(TxQueue, RxQueue, Option<(FillQueue, CompQueue)>), SocketCreateError>
Create and bind a new AF_XDP socket to a given interface and queue id using the underlying UMEM.
May require root permissions to create successfully.
Whether you can expect the returned Option<(FillQueue, CompQueue)>
to be Some
or
None
depends on a couple of things:
- If the
Umem
is currently shared (i.e. being used for >=1 AF_XDP sockets elsewhere):
-
If the
(if_name, queue_id)
pair is not bound to, expectSome
. -
If the
(if_name, queue_id)
pair is bound to, expectNone
and use theFillQueue
andCompQueue
originally returned for this pair.
For further details on using a shared Umem
please see the
docs.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl UnwindSafe for Socket
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more