vos_core/schema/objects/
mod.rs1use super::*;
2
3mod json;
4
5#[derive(Clone, Debug, Serialize, Deserialize)]
6pub enum Object {
7 Default,
8 Boolean(bool),
9 Number(Number),
10 Reference(String),
11 Text(Text),
12 List(List),
13 Dict(Dict),
14}
15
16impl From<&str> for Object {
17 fn from(value: &str) -> Self {
18 Object::text(value, "")
19 }
20}
21impl From<&String> for Object {
22 fn from(value: &String) -> Self {
23 Object::text(value, "")
24 }
25}
26impl From<String> for Object {
27 fn from(value: String) -> Self {
28 Object::text(value, "")
29 }
30}
31
32impl Object {
33 pub fn text(text: impl Into<String>, hint: impl Into<String>) -> Self {
34 Object::Text(Text { hint: hint.into(), value: text.into() })
35 }
36 pub fn number(number: impl Into<BigDecimal>, hint: impl Into<String>) -> Self {
37 Object::Number(Number { hint: hint.into(), value: number.into() })
38 }
39}