Skip to main content

dope_sys/io/request/
mod.rs

1mod borrow;
2mod complete;
3mod context;
4mod datagram;
5mod execute;
6mod lower;
7mod source;
8
9use std::os::fd;
10
11pub use borrow::Borrow;
12pub use complete::Complete;
13pub use context::Context;
14pub use datagram::Datagram;
15pub use execute::Execute;
16pub use lower::Lower;
17pub use source::Source;
18
19use crate::io::file;
20
21/// File requests retaining their descriptor, path, options, and input borrows.
22pub trait Request<'a>: Sized {
23    type Buffer;
24    type Options;
25
26    fn options(flags: file::Open, mode: file::Mode) -> Self::Options;
27    fn open(dir: fd::BorrowedFd<'a>, path: &'a std::ffi::CStr, options: &'a Self::Options) -> Self;
28    fn write(file: fd::BorrowedFd<'a>, input: Self::Buffer, offset: file::Offset) -> Self;
29    /// Writes at the owned descriptor's current position, honoring `O_APPEND`.
30    fn write_current(file: fd::BorrowedFd<'a>, input: Self::Buffer) -> Self;
31    fn sync(file: fd::BorrowedFd<'a>, mode: file::Sync) -> Self;
32    fn rename(dir: fd::BorrowedFd<'a>, old: &'a std::ffi::CStr, new: &'a std::ffi::CStr) -> Self;
33    fn unlink(dir: fd::BorrowedFd<'a>, name: &'a std::ffi::CStr) -> Self;
34}