safer-ring 0.0.1

A safe Rust wrapper around io_uring with zero-cost abstractions and compile-time memory safety guarantees
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// This test should fail to compile because futures must not outlive their buffers

use safer_ring::{Ring, PinnedBuffer, ReadFuture};

fn create_future() -> ReadFuture<'static, 'static> {
    let ring = Ring::new(10).unwrap();
    let mut buffer = PinnedBuffer::with_capacity(1024);
    
    // This should not compile - future cannot have 'static lifetime
    // when buffer and ring have local lifetimes
    ring.read(0, buffer.as_mut_slice()).unwrap()
}

fn main() {
    let _future = create_future();
}