Skip to main content

base_scheduler/
file_open.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use super::FileOperation;
5use crate::{Cancellation, FileOptions, OperationResult};
6use std::{future::Future, path::Path};
7
8/// Create file resources through the chosen scheduler.
9pub trait FileOpen: FileOperation {
10    /// Open the file at `path` according to `options`, returning a resource for this scheduler's file operations.
11    fn file_open(
12        &self,
13        path: &Path,
14        options: FileOptions,
15        cancellation: &Cancellation,
16    ) -> impl Future<Output = OperationResult<Self::File>> + Send;
17}