diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-07-02 19:59:52 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-07-02 20:07:43 +0200 |
| commit | ebfdb1dafa430786db10dad2ef7d5467c1bdbed1 (patch) | |
| tree | 2bbc24ddb4124c4bb14dec0e536129d4de37b056 /src/eval/auto.rs | |
| parent | 3ab19185093d7709f824b95b979060ce125389d8 (diff) | |
Move everything into `crates/` directory
Diffstat (limited to 'src/eval/auto.rs')
| -rw-r--r-- | src/eval/auto.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/eval/auto.rs b/src/eval/auto.rs deleted file mode 100644 index e73b3f33..00000000 --- a/src/eval/auto.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::fmt::{self, Debug, Formatter}; - -use super::{CastInfo, FromValue, IntoValue, Reflect, Value}; -use crate::diag::StrResult; - -/// A value that indicates a smart default. -#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct AutoValue; - -impl IntoValue for AutoValue { - fn into_value(self) -> Value { - Value::Auto - } -} - -impl FromValue for AutoValue { - fn from_value(value: Value) -> StrResult<Self> { - match value { - Value::Auto => Ok(Self), - _ => Err(Self::error(&value)), - } - } -} - -impl Reflect for AutoValue { - fn describe() -> CastInfo { - CastInfo::Type("auto") - } - - fn castable(value: &Value) -> bool { - matches!(value, Value::Auto) - } -} - -impl Debug for AutoValue { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - f.pad("auto") - } -} |
