frclib_core/value/traits.rs
1use crate::value::FrcValue;
2
3use super::FrcType;
4
5/// A trait for converting a value into an [``FrcValue``](crate::value::FrcValue).
6pub trait IntoFrcValue: Send + Sync {
7 #[allow(missing_docs)]
8 fn into_frc_value(self) -> FrcValue;
9}
10
11impl<T: Into<FrcValue> + Send + Sync> IntoFrcValue for T {
12 fn into_frc_value(self) -> FrcValue {
13 self.into()
14 }
15}
16
17/// A trait allowing static type checking on some types that implement [``IntoFrcValue``](crate::value::IntoFrcValue).
18#[allow(unused)]
19pub trait StaticallyFrcTyped: IntoFrcValue {
20 /// The type of the value, used for static type checking.
21 const TYPE: FrcType;
22 /// Whether the value could be void.
23 ///
24 /// This may be superseeded by type unions but for now this will be used.
25 /// If this is true think of it as adding and Option<> around the type.
26 const COULD_BE_VOID: bool = false;
27}