Skip to main content

base_scheduler/
file_reading.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use crate::{FileOperation, FileReader};
5use std::io;
6
7/// Construct a sequential file reader bound to this scheduler. Backends select the handle representation; protocols need no monitor or raw dispatch capabilities.
8pub trait FileReading: FileOperation {
9    type Reader<'scheduler>: FileReader + '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_reader(&self, file: &Self::File) -> io::Result<Self::Reader<'_>>;
15}