(self: Box<Self>)
| 88 | |
| 89 | impl MorselPlanner for FileOpenFutureMorselPlanner { |
| 90 | fn plan(self: Box<Self>) -> Result<Option<MorselPlan>> { |
| 91 | match *self { |
| 92 | Self::Unopened { file_opener, file } => { |
| 93 | let io_future = async move { |
| 94 | let stream = file_opener.open(*file)?.await?; |
| 95 | Ok(Box::new(Self::ReadyStream(stream)) as Box<dyn MorselPlanner>) |
| 96 | } |
| 97 | .boxed(); |
| 98 | Ok(Some(MorselPlan::new().with_pending_planner(io_future))) |
| 99 | } |
| 100 | Self::ReadyStream(stream) => Ok(Some( |
| 101 | MorselPlan::new() |
| 102 | .with_morsels(vec![Box::new(FileStreamMorsel { stream })]), |
| 103 | )), |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | struct FileStreamMorsel { |
nothing calls this directly
no test coverage detected