Derive Default for StreamConfig
This commit is contained in:
@@ -8,17 +8,11 @@ use super::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Describes how the streams of a [`Machine`](crate::Machine) will be handled.
|
/// Describes how the streams of a [`Machine`](crate::Machine) will be handled.
|
||||||
|
#[derive(Default)]
|
||||||
pub struct StreamConfig {
|
pub struct StreamConfig {
|
||||||
inner: StreamConfigInner,
|
inner: StreamConfigInner,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for StreamConfig {
|
|
||||||
/// Defaults to using in-memory streams.
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::in_memory()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl StreamConfig {
|
impl StreamConfig {
|
||||||
/// Binds the input, output and error streams to stdin, stdout and stderr.
|
/// Binds the input, output and error streams to stdin, stdout and stderr.
|
||||||
pub fn stdio() -> Self {
|
pub fn stdio() -> Self {
|
||||||
@@ -37,8 +31,10 @@ impl StreamConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
enum StreamConfigInner {
|
enum StreamConfigInner {
|
||||||
Stdio,
|
Stdio,
|
||||||
|
#[default]
|
||||||
Memory,
|
Memory,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user