From: bakaq Date: Thu, 12 Dec 2024 08:38:55 +0000 (-0300) Subject: Derive Default for StreamConfig X-Git-Tag: v0.10.0~92^2~4 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=a75266c3ceac6430606c1a160cd85c3576bf64ec;p=scryer-prolog.git Derive Default for StreamConfig --- diff --git a/src/machine/config.rs b/src/machine/config.rs index 039cf2f4..4e1e0532 100644 --- a/src/machine/config.rs +++ b/src/machine/config.rs @@ -8,17 +8,11 @@ use super::{ }; /// Describes how the streams of a [`Machine`](crate::Machine) will be handled. +#[derive(Default)] pub struct StreamConfig { inner: StreamConfigInner, } -impl Default for StreamConfig { - /// Defaults to using in-memory streams. - fn default() -> Self { - Self::in_memory() - } -} - impl StreamConfig { /// Binds the input, output and error streams to stdin, stdout and stderr. pub fn stdio() -> Self { @@ -37,8 +31,10 @@ impl StreamConfig { } } +#[derive(Default)] enum StreamConfigInner { Stdio, + #[default] Memory, }