1use derive_more::Debug;
4use tokio::io::AsyncRead;
5
6pub type AnyInput = Input;
7pub type GraphInput = Input;
8pub type NoInput = ();
9pub type QueryInput = Input;
10pub type TextInput = Input;
11
12#[derive(Debug)]
13pub enum Input {
14 Ignored,
15 AsyncRead(#[debug(skip)] Box<dyn AsyncRead + Send + Sync + Unpin>),
16}
17
18impl Input {
19 #[cfg(feature = "std")]
20 pub fn as_stdio(&self) -> std::process::Stdio {
21 use std::process::Stdio;
22 match self {
23 Input::Ignored => Stdio::null(),
24 Input::AsyncRead(_) => Stdio::piped(),
25 }
26 }
27}
28
29#[cfg(feature = "std")]
30impl Into<std::process::Stdio> for Input {
31 fn into(self) -> std::process::Stdio {
32 use std::process::Stdio;
33 match self {
34 Input::Ignored => Stdio::null(),
35 Input::AsyncRead(_) => Stdio::piped(),
36 }
37 }
38}