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 cautiondefer_async_work: Requires careful application integrationuser_allocated_ring_memory: Requires custom memory management
Use validate() to check feature compatibility before use.
Fields§
§buffer_selection: boolEnable buffer selection for read operations
multi_shot: boolEnable multi-shot operations where supported
provided_buffers: boolEnable provided buffers for zero-copy operations
fast_poll: boolEnable fast poll for network operations
sq_poll: boolEnable submission queue polling
sq_thread_cpu: Option<u32>Enable io_uring kernel thread affinity
coop_taskrun: boolEnable cooperative task running
defer_taskrun: boolEnable task work defer
advanced_task_work: boolEnable advanced task work management (6.1+)
defer_async_work: boolEnable deferred async work until GETEVENTS (6.1+)
send_zc_reporting: boolEnable zero-copy send reporting (6.2+)
multishot_completion_batching: boolEnable completion batching for multishot operations (6.2+)
epoll_uring_wake: boolEnable EPOLL_URING_WAKE support (6.2+)
registered_ring_fd: boolEnable io_uring_register() with registered ring fd (6.3+)
multishot_timeouts: boolEnable multishot timeout operations (6.4+)
user_allocated_ring_memory: boolEnable user-allocated ring memory (6.5+)
async_cancel_op: boolEnable async operation cancellation (6.6+)
socket_command_support: boolEnable socket command support (6.6+)
direct_io_optimizations: boolEnable Direct I/O performance optimizations (6.6+)
msg_ring_speedup: boolEnable MSG_RING performance improvements (6.11+)
native_bind_listen: boolEnable native bind/listen operations (6.11+)
improved_huge_pages: boolEnable improved huge page handling (6.12+)
async_discard: boolEnable async discard operations (6.12+)
minimum_timeout_waits: boolEnable minimum timeout waits (6.12+)
absolute_timeouts: boolEnable absolute timeouts with multiple clock sources (6.12+)
incremental_buffer_consumption: boolEnable incremental buffer consumption (6.12+)
registered_buffer_cloning: boolEnable registered buffer cloning (6.12+)
Implementations§
Source§impl AdvancedConfig
impl AdvancedConfig
Sourcepub fn new() -> Self
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);Sourcepub fn stable() -> Self
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 concernsSourcepub fn performance() -> Self
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);Sourcepub fn development() -> Self
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 debuggingSourcepub fn with_buffer_selection(self, enabled: bool) -> Self
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);Sourcepub fn with_multi_shot(self, enabled: bool) -> Self
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().
Sourcepub fn with_provided_buffers(self, enabled: bool) -> Self
pub fn with_provided_buffers(self, enabled: bool) -> Self
Enable provided buffers for zero-copy operations.
Sourcepub fn with_fast_poll(self, enabled: bool) -> Self
pub fn with_fast_poll(self, enabled: bool) -> Self
Enable fast poll for network operations.
Sourcepub fn with_sq_poll(self, enabled: bool, cpu: Option<u32>) -> Self
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.
Sourcepub fn with_coop_taskrun(self, enabled: bool) -> Self
pub fn with_coop_taskrun(self, enabled: bool) -> Self
Enable cooperative task running.
Sourcepub fn with_defer_taskrun(self, enabled: bool) -> Self
pub fn with_defer_taskrun(self, enabled: bool) -> Self
Enable task work defer.
Sourcepub fn with_advanced_task_work(self, enabled: bool) -> Self
pub fn with_advanced_task_work(self, enabled: bool) -> Self
Enable advanced task work management (6.1+).
Sourcepub fn with_send_zc_reporting(self, enabled: bool) -> Self
pub fn with_send_zc_reporting(self, enabled: bool) -> Self
Enable zero-copy send reporting (6.2+).
Sourcepub fn with_multishot_completion_batching(self, enabled: bool) -> Self
pub fn with_multishot_completion_batching(self, enabled: bool) -> Self
Enable completion batching for multishot operations (6.2+).
Sourcepub fn with_async_cancel_op(self, enabled: bool) -> Self
pub fn with_async_cancel_op(self, enabled: bool) -> Self
Enable async operation cancellation (6.6+).
Sourcepub fn with_direct_io_optimizations(self, enabled: bool) -> Self
pub fn with_direct_io_optimizations(self, enabled: bool) -> Self
Enable Direct I/O performance optimizations (6.6+).
Sourcepub fn enabled_features(&self) -> Vec<&'static str>
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);Sourcepub fn feature_count(&self) -> usize
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);Sourcepub fn validate(&self) -> Vec<String>
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
impl Clone for AdvancedConfig
Source§fn clone(&self) -> AdvancedConfig
fn clone(&self) -> AdvancedConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more