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
impl DirectProbeDetector
Sourcepub fn new() -> Result<Self>
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
Sourcepub fn probe_kernel_features(&self) -> AvailableFeatures
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§
impl Freeze for DirectProbeDetector
impl RefUnwindSafe for DirectProbeDetector
impl Send for DirectProbeDetector
impl Sync for DirectProbeDetector
impl Unpin for DirectProbeDetector
impl UnsafeUnpin for DirectProbeDetector
impl UnwindSafe for DirectProbeDetector
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