Skip to main content

LinoValue

Enum LinoValue 

Source
pub enum LinoValue {
    Null,
    Bool(bool),
    Int(i64),
    Float(f64),
    String(String),
    Array(Vec<LinoValue>),
    Object(Vec<(String, LinoValue)>),
}
Expand description

A value that can be encoded/decoded using the Links Notation codec.

This type supports all the types available in Python/JavaScript versions including special float values (NaN, Infinity) that are not valid JSON.

Variants§

§

Null

Null value

§

Bool(bool)

Boolean value

§

Int(i64)

Integer value (64-bit signed)

§

Float(f64)

Floating point value (64-bit)

§

String(String)

String value

§

Array(Vec<LinoValue>)

Array of values

§

Object(Vec<(String, LinoValue)>)

Object/dictionary with string keys

Implementations§

Source§

impl LinoValue

Source

pub fn object<I, K, V>(iter: I) -> Self
where I: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<LinoValue>,

Create an object from an iterator of key-value pairs.

Examples found in repository?
examples/basic_usage.rs (lines 96-100)
5fn main() {
6    println!("=== Links Notation Objects Codec - Rust Example ===\n");
7
8    // Example 1: Basic types
9    println!("1. Basic Types:");
10
11    // Null
12    let null_val = LinoValue::Null;
13    let encoded = encode(&null_val);
14    println!(
15        "   Null: {} -> decoded: {:?}",
16        encoded,
17        decode(&encoded).unwrap()
18    );
19
20    // Booleans
21    let true_val = LinoValue::Bool(true);
22    let encoded = encode(&true_val);
23    println!(
24        "   true: {} -> decoded: {:?}",
25        encoded,
26        decode(&encoded).unwrap()
27    );
28
29    // Integers
30    let int_val = LinoValue::Int(42);
31    let encoded = encode(&int_val);
32    println!(
33        "   42: {} -> decoded: {:?}",
34        encoded,
35        decode(&encoded).unwrap()
36    );
37
38    // Floats
39    let float_val = LinoValue::Float(3.14159);
40    let encoded = encode(&float_val);
41    println!(
42        "   3.14159: {} -> decoded: {:?}",
43        encoded,
44        decode(&encoded).unwrap()
45    );
46
47    // Special floats
48    let inf_val = LinoValue::Float(f64::INFINITY);
49    let encoded = encode(&inf_val);
50    println!(
51        "   Infinity: {} -> decoded: {:?}",
52        encoded,
53        decode(&encoded).unwrap()
54    );
55
56    let nan_val = LinoValue::Float(f64::NAN);
57    let encoded = encode(&nan_val);
58    let decoded = decode(&encoded).unwrap();
59    println!(
60        "   NaN: {} -> decoded is_nan: {}",
61        encoded,
62        decoded.as_float().unwrap().is_nan()
63    );
64
65    // Strings
66    let str_val = LinoValue::String("Hello, World!".to_string());
67    let encoded = encode(&str_val);
68    println!(
69        "   'Hello, World!': {} -> decoded: {:?}",
70        encoded,
71        decode(&encoded).unwrap()
72    );
73
74    // Unicode strings
75    let unicode_val = LinoValue::String("你好世界 🌍".to_string());
76    let encoded = encode(&unicode_val);
77    println!(
78        "   Unicode: {} -> decoded: {:?}",
79        encoded,
80        decode(&encoded).unwrap()
81    );
82
83    println!();
84
85    // Example 2: Collections
86    println!("2. Collections:");
87
88    // Array
89    let array_val = LinoValue::array([LinoValue::Int(1), LinoValue::Int(2), LinoValue::Int(3)]);
90    let encoded = encode(&array_val);
91    let decoded = decode(&encoded).unwrap();
92    println!("   Array [1, 2, 3]: {}", encoded);
93    println!("   Decoded: {:?}", decoded);
94
95    // Object
96    let obj_val = LinoValue::object([
97        ("name", LinoValue::String("Alice".to_string())),
98        ("age", LinoValue::Int(30)),
99        ("active", LinoValue::Bool(true)),
100    ]);
101    let encoded = encode(&obj_val);
102    let decoded = decode(&encoded).unwrap();
103    println!("   Object {{name, age, active}}: {}", encoded);
104    println!("   Decoded: {:?}", decoded);
105
106    println!();
107
108    // Example 3: Nested structures
109    println!("3. Nested Structure:");
110
111    let complex = LinoValue::object([
112        ("id", LinoValue::Int(123)),
113        ("name", LinoValue::String("Test Object".to_string())),
114        (
115            "tags",
116            LinoValue::array([
117                LinoValue::String("tag1".to_string()),
118                LinoValue::String("tag2".to_string()),
119            ]),
120        ),
121        (
122            "metadata",
123            LinoValue::object([
124                ("version", LinoValue::Int(1)),
125                ("created", LinoValue::String("2025-01-01".to_string())),
126            ]),
127        ),
128    ]);
129
130    let encoded = encode(&complex);
131    let decoded = decode(&encoded).unwrap();
132
133    println!("   Encoded: {}", encoded);
134    println!("   Decoded name: {:?}", decoded.get("name"));
135    println!("   Decoded tags: {:?}", decoded.get("tags"));
136    println!(
137        "   Decoded metadata.version: {:?}",
138        decoded.get("metadata").and_then(|m| m.get("version"))
139    );
140
141    println!();
142
143    // Example 4: Mixed type array
144    println!("4. Mixed Type Array:");
145
146    let mixed = LinoValue::array([
147        LinoValue::Int(1),
148        LinoValue::String("hello".to_string()),
149        LinoValue::Bool(true),
150        LinoValue::Null,
151        LinoValue::Float(2.5),
152    ]);
153
154    let encoded = encode(&mixed);
155    let decoded = decode(&encoded).unwrap();
156
157    println!("   Encoded: {}", encoded);
158    println!("   Decoded: {:?}", decoded);
159
160    println!();
161
162    // Example 5: Roundtrip verification
163    println!("5. Roundtrip Verification:");
164
165    let data = LinoValue::object([
166        (
167            "users",
168            LinoValue::array([
169                LinoValue::object([
170                    ("id", LinoValue::Int(1)),
171                    ("name", LinoValue::String("Alice".to_string())),
172                ]),
173                LinoValue::object([
174                    ("id", LinoValue::Int(2)),
175                    ("name", LinoValue::String("Bob".to_string())),
176                ]),
177            ]),
178        ),
179        ("count", LinoValue::Int(2)),
180    ]);
181
182    let encoded = encode(&data);
183    let decoded = decode(&encoded).unwrap();
184
185    println!("   Original == Decoded: {}", data == decoded);
186
187    println!("\n=== Example completed successfully! ===");
188}
Source

pub fn array<I, V>(iter: I) -> Self
where I: IntoIterator<Item = V>, V: Into<LinoValue>,

Create an array from an iterator of values.

Examples found in repository?
examples/basic_usage.rs (line 89)
5fn main() {
6    println!("=== Links Notation Objects Codec - Rust Example ===\n");
7
8    // Example 1: Basic types
9    println!("1. Basic Types:");
10
11    // Null
12    let null_val = LinoValue::Null;
13    let encoded = encode(&null_val);
14    println!(
15        "   Null: {} -> decoded: {:?}",
16        encoded,
17        decode(&encoded).unwrap()
18    );
19
20    // Booleans
21    let true_val = LinoValue::Bool(true);
22    let encoded = encode(&true_val);
23    println!(
24        "   true: {} -> decoded: {:?}",
25        encoded,
26        decode(&encoded).unwrap()
27    );
28
29    // Integers
30    let int_val = LinoValue::Int(42);
31    let encoded = encode(&int_val);
32    println!(
33        "   42: {} -> decoded: {:?}",
34        encoded,
35        decode(&encoded).unwrap()
36    );
37
38    // Floats
39    let float_val = LinoValue::Float(3.14159);
40    let encoded = encode(&float_val);
41    println!(
42        "   3.14159: {} -> decoded: {:?}",
43        encoded,
44        decode(&encoded).unwrap()
45    );
46
47    // Special floats
48    let inf_val = LinoValue::Float(f64::INFINITY);
49    let encoded = encode(&inf_val);
50    println!(
51        "   Infinity: {} -> decoded: {:?}",
52        encoded,
53        decode(&encoded).unwrap()
54    );
55
56    let nan_val = LinoValue::Float(f64::NAN);
57    let encoded = encode(&nan_val);
58    let decoded = decode(&encoded).unwrap();
59    println!(
60        "   NaN: {} -> decoded is_nan: {}",
61        encoded,
62        decoded.as_float().unwrap().is_nan()
63    );
64
65    // Strings
66    let str_val = LinoValue::String("Hello, World!".to_string());
67    let encoded = encode(&str_val);
68    println!(
69        "   'Hello, World!': {} -> decoded: {:?}",
70        encoded,
71        decode(&encoded).unwrap()
72    );
73
74    // Unicode strings
75    let unicode_val = LinoValue::String("你好世界 🌍".to_string());
76    let encoded = encode(&unicode_val);
77    println!(
78        "   Unicode: {} -> decoded: {:?}",
79        encoded,
80        decode(&encoded).unwrap()
81    );
82
83    println!();
84
85    // Example 2: Collections
86    println!("2. Collections:");
87
88    // Array
89    let array_val = LinoValue::array([LinoValue::Int(1), LinoValue::Int(2), LinoValue::Int(3)]);
90    let encoded = encode(&array_val);
91    let decoded = decode(&encoded).unwrap();
92    println!("   Array [1, 2, 3]: {}", encoded);
93    println!("   Decoded: {:?}", decoded);
94
95    // Object
96    let obj_val = LinoValue::object([
97        ("name", LinoValue::String("Alice".to_string())),
98        ("age", LinoValue::Int(30)),
99        ("active", LinoValue::Bool(true)),
100    ]);
101    let encoded = encode(&obj_val);
102    let decoded = decode(&encoded).unwrap();
103    println!("   Object {{name, age, active}}: {}", encoded);
104    println!("   Decoded: {:?}", decoded);
105
106    println!();
107
108    // Example 3: Nested structures
109    println!("3. Nested Structure:");
110
111    let complex = LinoValue::object([
112        ("id", LinoValue::Int(123)),
113        ("name", LinoValue::String("Test Object".to_string())),
114        (
115            "tags",
116            LinoValue::array([
117                LinoValue::String("tag1".to_string()),
118                LinoValue::String("tag2".to_string()),
119            ]),
120        ),
121        (
122            "metadata",
123            LinoValue::object([
124                ("version", LinoValue::Int(1)),
125                ("created", LinoValue::String("2025-01-01".to_string())),
126            ]),
127        ),
128    ]);
129
130    let encoded = encode(&complex);
131    let decoded = decode(&encoded).unwrap();
132
133    println!("   Encoded: {}", encoded);
134    println!("   Decoded name: {:?}", decoded.get("name"));
135    println!("   Decoded tags: {:?}", decoded.get("tags"));
136    println!(
137        "   Decoded metadata.version: {:?}",
138        decoded.get("metadata").and_then(|m| m.get("version"))
139    );
140
141    println!();
142
143    // Example 4: Mixed type array
144    println!("4. Mixed Type Array:");
145
146    let mixed = LinoValue::array([
147        LinoValue::Int(1),
148        LinoValue::String("hello".to_string()),
149        LinoValue::Bool(true),
150        LinoValue::Null,
151        LinoValue::Float(2.5),
152    ]);
153
154    let encoded = encode(&mixed);
155    let decoded = decode(&encoded).unwrap();
156
157    println!("   Encoded: {}", encoded);
158    println!("   Decoded: {:?}", decoded);
159
160    println!();
161
162    // Example 5: Roundtrip verification
163    println!("5. Roundtrip Verification:");
164
165    let data = LinoValue::object([
166        (
167            "users",
168            LinoValue::array([
169                LinoValue::object([
170                    ("id", LinoValue::Int(1)),
171                    ("name", LinoValue::String("Alice".to_string())),
172                ]),
173                LinoValue::object([
174                    ("id", LinoValue::Int(2)),
175                    ("name", LinoValue::String("Bob".to_string())),
176                ]),
177            ]),
178        ),
179        ("count", LinoValue::Int(2)),
180    ]);
181
182    let encoded = encode(&data);
183    let decoded = decode(&encoded).unwrap();
184
185    println!("   Original == Decoded: {}", data == decoded);
186
187    println!("\n=== Example completed successfully! ===");
188}
Source

pub fn is_null(&self) -> bool

Check if this is a null value.

Source

pub fn as_bool(&self) -> Option<bool>

Get as a boolean, if this is a bool.

Source

pub fn as_int(&self) -> Option<i64>

Get as an integer, if this is an int.

Source

pub fn as_float(&self) -> Option<f64>

Get as a float, if this is a float or int.

Examples found in repository?
examples/basic_usage.rs (line 62)
5fn main() {
6    println!("=== Links Notation Objects Codec - Rust Example ===\n");
7
8    // Example 1: Basic types
9    println!("1. Basic Types:");
10
11    // Null
12    let null_val = LinoValue::Null;
13    let encoded = encode(&null_val);
14    println!(
15        "   Null: {} -> decoded: {:?}",
16        encoded,
17        decode(&encoded).unwrap()
18    );
19
20    // Booleans
21    let true_val = LinoValue::Bool(true);
22    let encoded = encode(&true_val);
23    println!(
24        "   true: {} -> decoded: {:?}",
25        encoded,
26        decode(&encoded).unwrap()
27    );
28
29    // Integers
30    let int_val = LinoValue::Int(42);
31    let encoded = encode(&int_val);
32    println!(
33        "   42: {} -> decoded: {:?}",
34        encoded,
35        decode(&encoded).unwrap()
36    );
37
38    // Floats
39    let float_val = LinoValue::Float(3.14159);
40    let encoded = encode(&float_val);
41    println!(
42        "   3.14159: {} -> decoded: {:?}",
43        encoded,
44        decode(&encoded).unwrap()
45    );
46
47    // Special floats
48    let inf_val = LinoValue::Float(f64::INFINITY);
49    let encoded = encode(&inf_val);
50    println!(
51        "   Infinity: {} -> decoded: {:?}",
52        encoded,
53        decode(&encoded).unwrap()
54    );
55
56    let nan_val = LinoValue::Float(f64::NAN);
57    let encoded = encode(&nan_val);
58    let decoded = decode(&encoded).unwrap();
59    println!(
60        "   NaN: {} -> decoded is_nan: {}",
61        encoded,
62        decoded.as_float().unwrap().is_nan()
63    );
64
65    // Strings
66    let str_val = LinoValue::String("Hello, World!".to_string());
67    let encoded = encode(&str_val);
68    println!(
69        "   'Hello, World!': {} -> decoded: {:?}",
70        encoded,
71        decode(&encoded).unwrap()
72    );
73
74    // Unicode strings
75    let unicode_val = LinoValue::String("你好世界 🌍".to_string());
76    let encoded = encode(&unicode_val);
77    println!(
78        "   Unicode: {} -> decoded: {:?}",
79        encoded,
80        decode(&encoded).unwrap()
81    );
82
83    println!();
84
85    // Example 2: Collections
86    println!("2. Collections:");
87
88    // Array
89    let array_val = LinoValue::array([LinoValue::Int(1), LinoValue::Int(2), LinoValue::Int(3)]);
90    let encoded = encode(&array_val);
91    let decoded = decode(&encoded).unwrap();
92    println!("   Array [1, 2, 3]: {}", encoded);
93    println!("   Decoded: {:?}", decoded);
94
95    // Object
96    let obj_val = LinoValue::object([
97        ("name", LinoValue::String("Alice".to_string())),
98        ("age", LinoValue::Int(30)),
99        ("active", LinoValue::Bool(true)),
100    ]);
101    let encoded = encode(&obj_val);
102    let decoded = decode(&encoded).unwrap();
103    println!("   Object {{name, age, active}}: {}", encoded);
104    println!("   Decoded: {:?}", decoded);
105
106    println!();
107
108    // Example 3: Nested structures
109    println!("3. Nested Structure:");
110
111    let complex = LinoValue::object([
112        ("id", LinoValue::Int(123)),
113        ("name", LinoValue::String("Test Object".to_string())),
114        (
115            "tags",
116            LinoValue::array([
117                LinoValue::String("tag1".to_string()),
118                LinoValue::String("tag2".to_string()),
119            ]),
120        ),
121        (
122            "metadata",
123            LinoValue::object([
124                ("version", LinoValue::Int(1)),
125                ("created", LinoValue::String("2025-01-01".to_string())),
126            ]),
127        ),
128    ]);
129
130    let encoded = encode(&complex);
131    let decoded = decode(&encoded).unwrap();
132
133    println!("   Encoded: {}", encoded);
134    println!("   Decoded name: {:?}", decoded.get("name"));
135    println!("   Decoded tags: {:?}", decoded.get("tags"));
136    println!(
137        "   Decoded metadata.version: {:?}",
138        decoded.get("metadata").and_then(|m| m.get("version"))
139    );
140
141    println!();
142
143    // Example 4: Mixed type array
144    println!("4. Mixed Type Array:");
145
146    let mixed = LinoValue::array([
147        LinoValue::Int(1),
148        LinoValue::String("hello".to_string()),
149        LinoValue::Bool(true),
150        LinoValue::Null,
151        LinoValue::Float(2.5),
152    ]);
153
154    let encoded = encode(&mixed);
155    let decoded = decode(&encoded).unwrap();
156
157    println!("   Encoded: {}", encoded);
158    println!("   Decoded: {:?}", decoded);
159
160    println!();
161
162    // Example 5: Roundtrip verification
163    println!("5. Roundtrip Verification:");
164
165    let data = LinoValue::object([
166        (
167            "users",
168            LinoValue::array([
169                LinoValue::object([
170                    ("id", LinoValue::Int(1)),
171                    ("name", LinoValue::String("Alice".to_string())),
172                ]),
173                LinoValue::object([
174                    ("id", LinoValue::Int(2)),
175                    ("name", LinoValue::String("Bob".to_string())),
176                ]),
177            ]),
178        ),
179        ("count", LinoValue::Int(2)),
180    ]);
181
182    let encoded = encode(&data);
183    let decoded = decode(&encoded).unwrap();
184
185    println!("   Original == Decoded: {}", data == decoded);
186
187    println!("\n=== Example completed successfully! ===");
188}
Source

pub fn as_str(&self) -> Option<&str>

Get as a string, if this is a string.

Source

pub fn as_array(&self) -> Option<&Vec<LinoValue>>

Get as an array, if this is an array.

Source

pub fn as_object(&self) -> Option<&Vec<(String, LinoValue)>>

Get as an object, if this is an object.

Source

pub fn get(&self, key: &str) -> Option<&LinoValue>

Get a value from an object by key.

Examples found in repository?
examples/basic_usage.rs (line 134)
5fn main() {
6    println!("=== Links Notation Objects Codec - Rust Example ===\n");
7
8    // Example 1: Basic types
9    println!("1. Basic Types:");
10
11    // Null
12    let null_val = LinoValue::Null;
13    let encoded = encode(&null_val);
14    println!(
15        "   Null: {} -> decoded: {:?}",
16        encoded,
17        decode(&encoded).unwrap()
18    );
19
20    // Booleans
21    let true_val = LinoValue::Bool(true);
22    let encoded = encode(&true_val);
23    println!(
24        "   true: {} -> decoded: {:?}",
25        encoded,
26        decode(&encoded).unwrap()
27    );
28
29    // Integers
30    let int_val = LinoValue::Int(42);
31    let encoded = encode(&int_val);
32    println!(
33        "   42: {} -> decoded: {:?}",
34        encoded,
35        decode(&encoded).unwrap()
36    );
37
38    // Floats
39    let float_val = LinoValue::Float(3.14159);
40    let encoded = encode(&float_val);
41    println!(
42        "   3.14159: {} -> decoded: {:?}",
43        encoded,
44        decode(&encoded).unwrap()
45    );
46
47    // Special floats
48    let inf_val = LinoValue::Float(f64::INFINITY);
49    let encoded = encode(&inf_val);
50    println!(
51        "   Infinity: {} -> decoded: {:?}",
52        encoded,
53        decode(&encoded).unwrap()
54    );
55
56    let nan_val = LinoValue::Float(f64::NAN);
57    let encoded = encode(&nan_val);
58    let decoded = decode(&encoded).unwrap();
59    println!(
60        "   NaN: {} -> decoded is_nan: {}",
61        encoded,
62        decoded.as_float().unwrap().is_nan()
63    );
64
65    // Strings
66    let str_val = LinoValue::String("Hello, World!".to_string());
67    let encoded = encode(&str_val);
68    println!(
69        "   'Hello, World!': {} -> decoded: {:?}",
70        encoded,
71        decode(&encoded).unwrap()
72    );
73
74    // Unicode strings
75    let unicode_val = LinoValue::String("你好世界 🌍".to_string());
76    let encoded = encode(&unicode_val);
77    println!(
78        "   Unicode: {} -> decoded: {:?}",
79        encoded,
80        decode(&encoded).unwrap()
81    );
82
83    println!();
84
85    // Example 2: Collections
86    println!("2. Collections:");
87
88    // Array
89    let array_val = LinoValue::array([LinoValue::Int(1), LinoValue::Int(2), LinoValue::Int(3)]);
90    let encoded = encode(&array_val);
91    let decoded = decode(&encoded).unwrap();
92    println!("   Array [1, 2, 3]: {}", encoded);
93    println!("   Decoded: {:?}", decoded);
94
95    // Object
96    let obj_val = LinoValue::object([
97        ("name", LinoValue::String("Alice".to_string())),
98        ("age", LinoValue::Int(30)),
99        ("active", LinoValue::Bool(true)),
100    ]);
101    let encoded = encode(&obj_val);
102    let decoded = decode(&encoded).unwrap();
103    println!("   Object {{name, age, active}}: {}", encoded);
104    println!("   Decoded: {:?}", decoded);
105
106    println!();
107
108    // Example 3: Nested structures
109    println!("3. Nested Structure:");
110
111    let complex = LinoValue::object([
112        ("id", LinoValue::Int(123)),
113        ("name", LinoValue::String("Test Object".to_string())),
114        (
115            "tags",
116            LinoValue::array([
117                LinoValue::String("tag1".to_string()),
118                LinoValue::String("tag2".to_string()),
119            ]),
120        ),
121        (
122            "metadata",
123            LinoValue::object([
124                ("version", LinoValue::Int(1)),
125                ("created", LinoValue::String("2025-01-01".to_string())),
126            ]),
127        ),
128    ]);
129
130    let encoded = encode(&complex);
131    let decoded = decode(&encoded).unwrap();
132
133    println!("   Encoded: {}", encoded);
134    println!("   Decoded name: {:?}", decoded.get("name"));
135    println!("   Decoded tags: {:?}", decoded.get("tags"));
136    println!(
137        "   Decoded metadata.version: {:?}",
138        decoded.get("metadata").and_then(|m| m.get("version"))
139    );
140
141    println!();
142
143    // Example 4: Mixed type array
144    println!("4. Mixed Type Array:");
145
146    let mixed = LinoValue::array([
147        LinoValue::Int(1),
148        LinoValue::String("hello".to_string()),
149        LinoValue::Bool(true),
150        LinoValue::Null,
151        LinoValue::Float(2.5),
152    ]);
153
154    let encoded = encode(&mixed);
155    let decoded = decode(&encoded).unwrap();
156
157    println!("   Encoded: {}", encoded);
158    println!("   Decoded: {:?}", decoded);
159
160    println!();
161
162    // Example 5: Roundtrip verification
163    println!("5. Roundtrip Verification:");
164
165    let data = LinoValue::object([
166        (
167            "users",
168            LinoValue::array([
169                LinoValue::object([
170                    ("id", LinoValue::Int(1)),
171                    ("name", LinoValue::String("Alice".to_string())),
172                ]),
173                LinoValue::object([
174                    ("id", LinoValue::Int(2)),
175                    ("name", LinoValue::String("Bob".to_string())),
176                ]),
177            ]),
178        ),
179        ("count", LinoValue::Int(2)),
180    ]);
181
182    let encoded = encode(&data);
183    let decoded = decode(&encoded).unwrap();
184
185    println!("   Original == Decoded: {}", data == decoded);
186
187    println!("\n=== Example completed successfully! ===");
188}
Source

pub fn get_index(&self, index: usize) -> Option<&LinoValue>

Get a value from an array by index.

Trait Implementations§

Source§

impl Clone for LinoValue

Source§

fn clone(&self) -> LinoValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LinoValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&str> for LinoValue

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<()> for LinoValue

Source§

fn from(_: ()) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<LinoValue>> From<Option<T>> for LinoValue

Source§

fn from(opt: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for LinoValue

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<LinoValue>> From<Vec<T>> for LinoValue

Source§

fn from(v: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for LinoValue

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for LinoValue

Source§

fn from(f: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for LinoValue

Source§

fn from(i: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for LinoValue

Source§

fn from(i: i64) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for LinoValue

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.