Create a new iterator from the given file descriptor and buffer.
(fd: Fd, buf: &'buf mut [MaybeUninit<u8>])
| 105 | impl<'buf, Fd: AsFd> Reader<'buf, Fd> { |
| 106 | /// Create a new iterator from the given file descriptor and buffer. |
| 107 | pub fn new(fd: Fd, buf: &'buf mut [MaybeUninit<u8>]) -> Self { |
| 108 | Self { |
| 109 | fd, |
| 110 | buf: { |
| 111 | let offset = buf.as_ptr().align_offset(align_of::<inotify_event>()); |
| 112 | if offset < buf.len() { |
| 113 | &mut buf[offset..] |
| 114 | } else { |
| 115 | &mut [] |
| 116 | } |
| 117 | }, |
| 118 | initialized: 0, |
| 119 | offset: 0, |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /// An inotify event. |