Skip to main content

base_scheduler/
file_writing.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use crate::{FileOperation, FileWriter};
5use std::io;
6
7/// Construct a sequential file writer bound to this scheduler. Backends select the handle representation; protocols need no monitor or raw dispatch capabilities.
8pub trait FileWriting: FileOperation {
9    type Writer<'scheduler>: FileWriter + 'scheduler
10    where
11        Self: 'scheduler;
12
13    /// Retain the file and reusable backend state without submitting I/O. The file reference need not live as long as the returned handle. Cancellation remains an operation argument.
14    fn file_writer(&self, file: &Self::File) -> io::Result<Self::Writer<'_>>;
15}