AdvancedConfig

Struct AdvancedConfig 

Source
pub struct AdvancedConfig {
Show 27 fields pub buffer_selection: bool, pub multi_shot: bool, pub provided_buffers: bool, pub fast_poll: bool, pub sq_poll: bool, pub sq_thread_cpu: Option<u32>, pub coop_taskrun: bool, pub defer_taskrun: bool, pub advanced_task_work: bool, pub defer_async_work: bool, pub send_zc_reporting: bool, pub multishot_completion_batching: bool, pub epoll_uring_wake: bool, pub registered_ring_fd: bool, pub multishot_timeouts: bool, pub user_allocated_ring_memory: bool, pub async_cancel_op: bool, pub socket_command_support: bool, pub direct_io_optimizations: bool, pub msg_ring_speedup: bool, pub native_bind_listen: bool, pub improved_huge_pages: bool, pub async_discard: bool, pub minimum_timeout_waits: bool, pub absolute_timeouts: bool, pub incremental_buffer_consumption: bool, pub registered_buffer_cloning: bool,
}
Expand description

Advanced features configuration for io_uring operations.

Enables configuration of advanced io_uring features that may not be available on all kernel versions. Features are disabled by default to ensure compatibility. Use the provided constructors and methods to create configurations suitable for your use case.

§Examples

use safer_ring::advanced::AdvancedConfig;

// Create a conservative configuration (all features disabled)
let conservative = AdvancedConfig::default();

// Create a configuration with basic stable features
let basic = AdvancedConfig::stable();

// Create a performance-optimized configuration
let performance = AdvancedConfig::performance();

// Enable specific features
let custom = AdvancedConfig::default()
    .with_buffer_selection(true)
    .with_multi_shot(true)
    .with_fast_poll(true);

§Feature Categories

Features are grouped by kernel version:

  • Legacy (5.1-5.19): Basic io_uring features
  • 6.1+: Advanced task management
  • 6.2+: Zero-copy optimizations and batching
  • 6.3-6.5: Enhanced resource management
  • 6.6+: Performance and cancellation improvements
  • 6.11-6.12: Latest optimizations

§Safety and Compatibility

Some features may have stability or performance implications:

  • sq_poll: High CPU usage, use with caution
  • defer_async_work: Requires careful application integration
  • user_allocated_ring_memory: Requires custom memory management

Use validate() to check feature compatibility before use.

Fields§

§buffer_selection: bool

Enable buffer selection for read operations

§multi_shot: bool

Enable multi-shot operations where supported

§provided_buffers: bool

Enable provided buffers for zero-copy operations

§fast_poll: bool

Enable fast poll for network operations

§sq_poll: bool

Enable submission queue polling

§sq_thread_cpu: Option<u32>

Enable io_uring kernel thread affinity

§coop_taskrun: bool

Enable cooperative task running

§defer_taskrun: bool

Enable task work defer

§advanced_task_work: bool

Enable advanced task work management (6.1+)

§defer_async_work: bool

Enable deferred async work until GETEVENTS (6.1+)

§send_zc_reporting: bool

Enable zero-copy send reporting (6.2+)

§multishot_completion_batching: bool

Enable completion batching for multishot operations (6.2+)

§epoll_uring_wake: bool

Enable EPOLL_URING_WAKE support (6.2+)

§registered_ring_fd: bool

Enable io_uring_register() with registered ring fd (6.3+)

§multishot_timeouts: bool

Enable multishot timeout operations (6.4+)

§user_allocated_ring_memory: bool

Enable user-allocated ring memory (6.5+)

§async_cancel_op: bool

Enable async operation cancellation (6.6+)

§socket_command_support: bool

Enable socket command support (6.6+)

§direct_io_optimizations: bool

Enable Direct I/O performance optimizations (6.6+)

§msg_ring_speedup: bool

Enable MSG_RING performance improvements (6.11+)

§native_bind_listen: bool

Enable native bind/listen operations (6.11+)

§improved_huge_pages: bool

Enable improved huge page handling (6.12+)

§async_discard: bool

Enable async discard operations (6.12+)

§minimum_timeout_waits: bool

Enable minimum timeout waits (6.12+)

§absolute_timeouts: bool

Enable absolute timeouts with multiple clock sources (6.12+)

§incremental_buffer_consumption: bool

Enable incremental buffer consumption (6.12+)

§registered_buffer_cloning: bool

Enable registered buffer cloning (6.12+)

Implementations§

Source§

impl AdvancedConfig

Source

pub fn new() -> Self

Create a new AdvancedConfig with all features disabled.

This is equivalent to AdvancedConfig::default() but more explicit. Provides maximum compatibility across all kernel versions.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::new();
assert!(!config.buffer_selection);
assert!(!config.multi_shot);
Source

pub fn stable() -> Self

Create a configuration with stable, well-tested features enabled.

Enables features that are considered stable and have minimal compatibility or performance risks. Suitable for production use on kernels 5.13+.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::stable();
assert!(config.buffer_selection);
assert!(config.fast_poll);
assert!(!config.sq_poll); // Disabled due to CPU usage concerns
Source

pub fn performance() -> Self

Create a performance-optimized configuration.

Enables features that can improve performance, including some that may have higher resource usage. Suitable for high-performance applications on modern kernels (6.2+).

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::performance();
assert!(config.multi_shot);
assert!(config.advanced_task_work);
assert!(config.multishot_completion_batching);
Source

pub fn development() -> Self

Create a development-friendly configuration.

Enables features that are helpful for development and testing, prioritizing debuggability over maximum performance.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::development();
assert!(config.buffer_selection);
assert!(!config.sq_poll); // Disabled for easier debugging
Source

pub fn with_buffer_selection(self, enabled: bool) -> Self

Enable buffer selection feature.

Buffer selection allows the kernel to choose buffers for read operations, improving efficiency for workloads with varying buffer sizes.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::new().with_buffer_selection(true);
assert!(config.buffer_selection);
Source

pub fn with_multi_shot(self, enabled: bool) -> Self

Enable multi-shot operations.

Multi-shot operations can handle multiple completions from a single submission, reducing system call overhead for operations like accept().

Source

pub fn with_provided_buffers(self, enabled: bool) -> Self

Enable provided buffers for zero-copy operations.

Source

pub fn with_fast_poll(self, enabled: bool) -> Self

Enable fast poll for network operations.

Source

pub fn with_sq_poll(self, enabled: bool, cpu: Option<u32>) -> Self

Enable submission queue polling with optional CPU affinity.

Warning: SQ polling uses dedicated CPU resources and should be used carefully in production environments.

Source

pub fn with_coop_taskrun(self, enabled: bool) -> Self

Enable cooperative task running.

Source

pub fn with_defer_taskrun(self, enabled: bool) -> Self

Enable task work defer.

Source

pub fn with_advanced_task_work(self, enabled: bool) -> Self

Enable advanced task work management (6.1+).

Source

pub fn with_send_zc_reporting(self, enabled: bool) -> Self

Enable zero-copy send reporting (6.2+).

Source

pub fn with_multishot_completion_batching(self, enabled: bool) -> Self

Enable completion batching for multishot operations (6.2+).

Source

pub fn with_async_cancel_op(self, enabled: bool) -> Self

Enable async operation cancellation (6.6+).

Source

pub fn with_direct_io_optimizations(self, enabled: bool) -> Self

Enable Direct I/O performance optimizations (6.6+).

Source

pub fn enabled_features(&self) -> Vec<&'static str>

Get a list of all enabled features.

Returns a vector of feature names that are currently enabled. Useful for logging, debugging, or feature validation.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::stable();
let enabled = config.enabled_features();
println!("Enabled features: {:?}", enabled);
Source

pub fn feature_count(&self) -> usize

Count the number of enabled features.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::stable();
let count = config.feature_count();
println!("Enabled {} features", count);
Source

pub fn validate(&self) -> Vec<String>

Validate the configuration for internal consistency.

Checks for feature combinations that are known to be problematic or mutually exclusive. Returns a list of warnings about the current configuration.

§Examples
use safer_ring::advanced::AdvancedConfig;

let config = AdvancedConfig::performance();
let warnings = config.validate();
if !warnings.is_empty() {
    println!("Configuration warnings: {:?}", warnings);
}

Trait Implementations§

Source§

impl Clone for AdvancedConfig

Source§

fn clone(&self) -> AdvancedConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdvancedConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AdvancedConfig

Source§

fn default() -> AdvancedConfig

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.