Skip to main content

DirectProbeDetector

Struct DirectProbeDetector 

Source
pub struct DirectProbeDetector { /* private fields */ }
Available on Linux only.
Expand description

Direct kernel probing for io_uring features.

This detector uses the io_uring kernel probing mechanism to directly query the kernel for supported operations and features, providing more accurate detection than version-based approaches.

Implementations§

Source§

impl DirectProbeDetector

Source

pub fn new() -> Result<Self>

Create a new direct probe detector.

Initializes a minimal io_uring instance for probing kernel capabilities. This requires io_uring to be available on the system and sufficient permissions to create io_uring instances.

§Examples
use safer_ring::advanced::feature_detection::DirectProbeDetector;

match DirectProbeDetector::new() {
    Ok(detector) => {
        let features = detector.probe_kernel_features();
        println!("Direct probe completed successfully");
    }
    Err(e) => {
        eprintln!("Direct probing failed: {}", e);
        // Fall back to version-based detection
    }
}
§Errors

Returns an error if:

  • io_uring initialization fails (insufficient permissions, kernel too old)
  • Probe registration fails (kernel doesn’t support probing)
  • System resources are insufficient for creating the temporary ring
Source

pub fn probe_kernel_features(&self) -> AvailableFeatures

Probe the kernel for available io_uring features.

This method directly queries the kernel to determine which io_uring operations and features are supported, providing the most accurate feature detection possible.

§Examples
use safer_ring::advanced::feature_detection::DirectProbeDetector;

let detector = DirectProbeDetector::new()?;
let features = detector.probe_kernel_features();

if features.multi_shot {
    println!("Multi-shot operations are supported");
}
if features.buffer_selection {
    println!("Buffer selection is supported");
}

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.