dope-sys 0.28.1

Typed operating-system call contracts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::io::poll::Entry;

/// # Safety
/// The returned slice must never contain more than `MAX` entries.
pub unsafe trait Entries<'fd> {
    const MAX: usize;
    fn entries(&mut self) -> &mut [Entry<'fd>];
}

// SAFETY: coercing this array to a slice retains its exact N-element extent.
unsafe impl<'fd, const N: usize> Entries<'fd> for [Entry<'fd>; N] {
    const MAX: usize = N;
    fn entries(&mut self) -> &mut [Entry<'fd>] {
        self
    }
}