datex_core/datex_values/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::fmt;
use crate::global::binary_codes::BinaryCode;
use super::{Value, ValueResult};

pub struct Error {
	pub message: String
}

impl Value for Error {
    fn to_string(&self) -> String {
		return format!("!{}", self.message);
    }

    fn binary_operation(&self, _code: BinaryCode, _other: Box<dyn Value>) -> ValueResult {
        todo!()
    }

    fn cast(&self, _dx_type: super::Type) -> ValueResult {
        todo!()
    }
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", Value::to_string(self))
    }
}