wait_on/resource/
mod.rs

1//! A [`Resource`] is an object that can be waited on. [`Resource`]s hold its
2//! own configuration based on the protocols used.
3
4pub mod file;
5pub mod http;
6pub mod tcp;
7
8use anyhow::Result;
9
10use crate::{WaitOptions, Waitable};
11
12use self::file::FileWaiter;
13use self::http::HttpWaiter;
14use self::tcp::TcpWaiter;
15
16#[derive(Clone)]
17pub enum Resource {
18    File(FileWaiter),
19    Http(HttpWaiter),
20    Tcp(TcpWaiter),
21}
22
23impl Waitable for Resource {
24    async fn wait(&self, options: &WaitOptions) -> Result<()> {
25        match self {
26            Resource::File(file) => file.wait(options).await,
27            Resource::Http(http) => http.wait(options).await,
28            Resource::Tcp(tcp) => tcp.wait(options).await,
29        }
30    }
31}