base-scheduler 0.3.1

Explicit, runtime-independent scheduler capabilities for protocol libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.

use crate::{FileOperation, FileReader};
use std::io;

/// Construct a sequential file reader bound to this scheduler. Backends select the handle representation; protocols need no monitor or raw dispatch capabilities.
pub trait FileReading: FileOperation {
    /// The scheduler-bound reader returned by [`file_reader`](Self::file_reader).
    type Reader<'scheduler>: FileReader + 'scheduler
    where
        Self: 'scheduler;

    /// 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.
    fn file_reader(&self, file: &Self::File) -> io::Result<Self::Reader<'_>>;
}