dope_sys/io/request/
mod.rs1mod complete;
2mod context;
3mod source;
4
5use std::{mem::MaybeUninit, os::fd};
6
7use o3::buffer::bytes::bounded;
8
9pub use complete::Complete;
10pub use context::Context;
11pub use source::Source;
12
13use crate::io::file;
14
15pub trait Request<'a>: Sized {
17 type Buffer;
18 type Options;
19 type Metadata;
20
21 fn options<const NO_SYMLINKS: bool>(flags: file::Open, mode: file::Mode) -> Self::Options;
22 fn open(dir: fd::BorrowedFd<'a>, path: &'a std::ffi::CStr, options: &'a Self::Options) -> Self;
23 fn metadata(file: fd::BorrowedFd<'a>, output: &'a mut Self::Metadata) -> Self;
24 fn read(
25 file: fd::BorrowedFd<'a>,
26 output: bounded::Value<&'a mut [MaybeUninit<u8>]>,
27 offset: file::Offset,
28 ) -> Self;
29 fn write(file: fd::BorrowedFd<'a>, input: Self::Buffer, offset: file::Offset) -> Self;
30 fn sync(file: fd::BorrowedFd<'a>, mode: file::Sync) -> Self;
31 fn rename(dir: fd::BorrowedFd<'a>, old: &'a std::ffi::CStr, new: &'a std::ffi::CStr) -> Self;
32 fn unlink(dir: fd::BorrowedFd<'a>, name: &'a std::ffi::CStr) -> Self;
33}