Skip to main content

Value

Enum Value 

Source
pub enum Value {
Show 16 variants Null, Bool(bool), Int(i64), UInt(u64), Double(f64), String(Arc<str>), Bytes(Arc<[u8]>), List(Arc<[Value]>), Map(Arc<ValueMap>), Timestamp(Timestamp), Duration(Duration), Type(TypeValue), Optional(OptionalValue), Message(Box<dyn MessageValue>), Enum(EnumValue), Error(Arc<EvalError>),
}
Expand description

A CEL runtime value.

This enum represents all possible values that can exist during CEL evaluation. Unlike CelValue (which represents compile-time constants), Value supports the full range of CEL types including collections, timestamps, and errors.

Variants§

§

Null

Null value.

§

Bool(bool)

Boolean value.

§

Int(i64)

Signed 64-bit integer.

§

UInt(u64)

Unsigned 64-bit integer.

§

Double(f64)

64-bit floating point.

§

String(Arc<str>)

Unicode string (Arc for cheap cloning).

§

Bytes(Arc<[u8]>)

Byte sequence (Arc for cheap cloning).

§

List(Arc<[Value]>)

Homogeneous list.

§

Map(Arc<ValueMap>)

Key-value map (uses BTreeMap for deterministic iteration).

§

Timestamp(Timestamp)

Timestamp (seconds and nanos since Unix epoch).

§

Duration(Duration)

Duration (seconds and nanos).

§

Type(TypeValue)

Type value (represents a CEL type at runtime).

§

Optional(OptionalValue)

Optional value (present or absent).

§

Message(Box<dyn MessageValue>)

Protobuf message value.

§

Enum(EnumValue)

Enum value with type information (strong enum typing).

§

Error(Arc<EvalError>)

Error value (evaluation errors propagate as values).

Implementations§

Source§

impl Value

Source

pub fn map<K, V>(entries: impl IntoIterator<Item = (K, V)>) -> Self
where K: Into<MapKey>, V: Into<Value>,

Create a map value from key-value pairs.

Keys and values are automatically converted using Into<MapKey> and Into<Value>.

use cel_core::Value;

// String keys and values
let map = Value::map([("host", "localhost"), ("port", "8080")]);

// Integer keys
let map = Value::map([(1i64, "one"), (2i64, "two")]);

// Mixed value types require explicit Value construction
let map = Value::map([
    ("name", Value::from("Alice")),
    ("age", Value::from(30i64)),
]);
Examples found in repository?
examples/maps.rs (lines 12-16)
7fn main() {
8    let env = Env::with_standard_library()
9        .with_variable("user", CelType::map(CelType::String, CelType::Dyn));
10
11    // Mixed value types require explicit Value::from()
12    let user = Value::map([
13        ("name", Value::from("Alice")),
14        ("age", Value::from(30)), // i32 automatically widens to i64
15        ("active", Value::from(true)),
16    ]);
17
18    let mut activation = MapActivation::new();
19    activation.insert("user", user);
20
21    // Field access
22    let ast = env.compile("user.name").unwrap();
23    let program = env.program(&ast).unwrap();
24    let result = program.eval(&activation);
25    println!("user.name:     {}", result);
26
27    // Index access
28    let ast = env.compile(r#"user["age"]"#).unwrap();
29    let program = env.program(&ast).unwrap();
30    let result = program.eval(&activation);
31    println!(r#"user["age"]:   {}"#, result);
32
33    // Check field existence with 'in'
34    let ast = env.compile(r#""name" in user"#).unwrap();
35    let program = env.program(&ast).unwrap();
36    let result = program.eval(&activation);
37    println!(r#""name" in user: {}"#, result);
38
39    // Check field existence with has()
40    let ast = env.compile("has(user.email)").unwrap();
41    let program = env.program(&ast).unwrap();
42    let result = program.eval(&activation);
43    println!("has(user.email): {}", result);
44
45    // Combine conditions
46    let ast = env.compile(r#"user.active && user.age >= 21"#).unwrap();
47    let program = env.program(&ast).unwrap();
48    let result = program.eval(&activation);
49    println!("active && age >= 21: {}", result);
50}
More examples
Hide additional examples
examples/error_handling.rs (line 43)
7fn main() {
8    let env = Env::with_standard_library()
9        .with_variable("x", CelType::Int)
10        .with_variable("items", CelType::list(CelType::Int));
11
12    let mut activation = MapActivation::new();
13
14    // Division by zero returns an error value
15    println!("=== Division by zero ===");
16    activation.insert("x", 0);
17    let ast = env.compile("10 / x").unwrap();
18    let program = env.program(&ast).unwrap();
19    let result = program.eval(&activation);
20
21    match &result {
22        Value::Error(err) => println!("Error: {}", err),
23        other => println!("Result: {}", other),
24    }
25
26    // Index out of bounds
27    println!("\n=== Index out of bounds ===");
28    activation.insert("items", Value::list([1, 2, 3]));
29    let ast = env.compile("items[10]").unwrap();
30    let program = env.program(&ast).unwrap();
31    let result = program.eval(&activation);
32
33    match &result {
34        Value::Error(err) => println!("Error: {}", err),
35        other => println!("Result: {}", other),
36    }
37
38    // Key not found in map
39    println!("\n=== Key not found ===");
40    let env = Env::with_standard_library()
41        .with_variable("config", CelType::map(CelType::String, CelType::String));
42    let mut activation = MapActivation::new();
43    activation.insert("config", Value::map([("host", "localhost")]));
44
45    let ast = env.compile("config.missing_key").unwrap();
46    let program = env.program(&ast).unwrap();
47    let result = program.eval(&activation);
48
49    match &result {
50        Value::Error(err) => println!("Error: {}", err),
51        other => println!("Result: {}", other),
52    }
53
54    // Use has() to safely check field existence
55    println!("\n=== Safe field access with has() ===");
56    let ast = env
57        .compile("has(config.missing_key) ? config.missing_key : 'default'")
58        .unwrap();
59    let program = env.program(&ast).unwrap();
60    let result = program.eval(&activation);
61    println!("Result: {}", result);
62}
examples/extract_values.rs (line 18)
7fn main() {
8    let env = Env::with_standard_library()
9        .with_variable("count", CelType::Int)
10        .with_variable("items", CelType::list(CelType::Int))
11        .with_variable("config", CelType::map(CelType::String, CelType::String));
12
13    let mut activation = MapActivation::new();
14    activation.insert("count", 42); // i32 automatically widens to i64
15    activation.insert("items", Value::list([1, 2, 3]));
16    activation.insert(
17        "config",
18        Value::map([("host", "localhost"), ("port", "8080")]),
19    );
20
21    // Extract i64
22    let ast = env.compile("count * 2").unwrap();
23    let program = env.program(&ast).unwrap();
24    let result = program.eval(&activation);
25
26    let value: i64 = (&result).try_into().expect("expected int");
27    println!("i64: {}", value);
28
29    // Extract bool
30    let ast = env.compile("count > 10").unwrap();
31    let program = env.program(&ast).unwrap();
32    let result = program.eval(&activation);
33
34    let value: bool = (&result).try_into().expect("expected bool");
35    println!("bool: {}", value);
36
37    // Extract &str
38    let ast = env.compile("config.host").unwrap();
39    let program = env.program(&ast).unwrap();
40    let result = program.eval(&activation);
41
42    let value: &str = (&result).try_into().expect("expected string");
43    println!("&str: {}", value);
44
45    // Extract &[Value] (list)
46    let ast = env.compile("items.filter(x, x > 1)").unwrap();
47    let program = env.program(&ast).unwrap();
48    let result = program.eval(&activation);
49
50    let list: &[Value] = (&result).try_into().expect("expected list");
51    println!("list length: {}", list.len());
52    for (i, v) in list.iter().enumerate() {
53        let n: i64 = v.try_into().expect("expected int");
54        println!("  [{}] = {}", i, n);
55    }
56
57    // Extract &ValueMap
58    let ast = env.compile("config").unwrap();
59    let program = env.program(&ast).unwrap();
60    let result = program.eval(&activation);
61
62    let map: &ValueMap = (&result).try_into().expect("expected map");
63    println!("map size: {}", map.len());
64    for (k, v) in map.iter() {
65        println!("  {:?} = {}", k, v);
66    }
67
68    // Handle errors gracefully
69    let result = Value::from("not an int");
70    let attempt: Result<i64, _> = (&result).try_into();
71    match attempt {
72        Ok(v) => println!("got: {}", v),
73        Err(e) => println!("conversion error: {}", e),
74    }
75
76    // Extract &OptionalValue
77    let opt_result = Value::optional_some(Value::from(99));
78    let opt: &OptionalValue = (&opt_result).try_into().expect("expected optional");
79    if opt.is_present() {
80        let inner: i64 = opt.as_value().unwrap().try_into().expect("expected int");
81        println!("optional value: {}", inner);
82    }
83}
Source

pub fn list<T>(items: impl IntoIterator<Item = T>) -> Self
where T: Into<Value>,

Create a list value from items.

Items are automatically converted using Into<Value>.

use cel_core::Value;

// Integer list (no i64 suffix needed)
let list = Value::list([1, 2, 3]);

// String list
let list = Value::list(["a", "b", "c"]);

// Mixed types require explicit Value construction
let list = Value::list([Value::from(1), Value::from("two")]);
Examples found in repository?
examples/lists.rs (line 11)
7fn main() {
8    let env = Env::with_standard_library().with_variable("numbers", CelType::list(CelType::Int));
9
10    let mut activation = MapActivation::new();
11    activation.insert("numbers", Value::list([1, 5, 3, 8, 2]));
12
13    // Filter: keep only values > 3
14    let ast = env.compile("numbers.filter(x, x > 3)").unwrap();
15    let program = env.program(&ast).unwrap();
16    let result = program.eval(&activation);
17    println!("filter(x, x > 3): {}", result);
18
19    // Map: double each value
20    let ast = env.compile("numbers.map(x, x * 2)").unwrap();
21    let program = env.program(&ast).unwrap();
22    let result = program.eval(&activation);
23    println!("map(x, x * 2):    {}", result);
24
25    // Exists: any value > 7?
26    let ast = env.compile("numbers.exists(x, x > 7)").unwrap();
27    let program = env.program(&ast).unwrap();
28    let result = program.eval(&activation);
29    println!("exists(x, x > 7): {}", result);
30
31    // All: all values > 0?
32    let ast = env.compile("numbers.all(x, x > 0)").unwrap();
33    let program = env.program(&ast).unwrap();
34    let result = program.eval(&activation);
35    println!("all(x, x > 0):    {}", result);
36
37    // Size
38    let ast = env.compile("numbers.size()").unwrap();
39    let program = env.program(&ast).unwrap();
40    let result = program.eval(&activation);
41    println!("size():           {}", result);
42
43    // Contains (using 'in' operator)
44    let ast = env.compile("5 in numbers").unwrap();
45    let program = env.program(&ast).unwrap();
46    let result = program.eval(&activation);
47    println!("5 in numbers:     {}", result);
48}
More examples
Hide additional examples
examples/error_handling.rs (line 28)
7fn main() {
8    let env = Env::with_standard_library()
9        .with_variable("x", CelType::Int)
10        .with_variable("items", CelType::list(CelType::Int));
11
12    let mut activation = MapActivation::new();
13
14    // Division by zero returns an error value
15    println!("=== Division by zero ===");
16    activation.insert("x", 0);
17    let ast = env.compile("10 / x").unwrap();
18    let program = env.program(&ast).unwrap();
19    let result = program.eval(&activation);
20
21    match &result {
22        Value::Error(err) => println!("Error: {}", err),
23        other => println!("Result: {}", other),
24    }
25
26    // Index out of bounds
27    println!("\n=== Index out of bounds ===");
28    activation.insert("items", Value::list([1, 2, 3]));
29    let ast = env.compile("items[10]").unwrap();
30    let program = env.program(&ast).unwrap();
31    let result = program.eval(&activation);
32
33    match &result {
34        Value::Error(err) => println!("Error: {}", err),
35        other => println!("Result: {}", other),
36    }
37
38    // Key not found in map
39    println!("\n=== Key not found ===");
40    let env = Env::with_standard_library()
41        .with_variable("config", CelType::map(CelType::String, CelType::String));
42    let mut activation = MapActivation::new();
43    activation.insert("config", Value::map([("host", "localhost")]));
44
45    let ast = env.compile("config.missing_key").unwrap();
46    let program = env.program(&ast).unwrap();
47    let result = program.eval(&activation);
48
49    match &result {
50        Value::Error(err) => println!("Error: {}", err),
51        other => println!("Result: {}", other),
52    }
53
54    // Use has() to safely check field existence
55    println!("\n=== Safe field access with has() ===");
56    let ast = env
57        .compile("has(config.missing_key) ? config.missing_key : 'default'")
58        .unwrap();
59    let program = env.program(&ast).unwrap();
60    let result = program.eval(&activation);
61    println!("Result: {}", result);
62}
examples/extract_values.rs (line 15)
7fn main() {
8    let env = Env::with_standard_library()
9        .with_variable("count", CelType::Int)
10        .with_variable("items", CelType::list(CelType::Int))
11        .with_variable("config", CelType::map(CelType::String, CelType::String));
12
13    let mut activation = MapActivation::new();
14    activation.insert("count", 42); // i32 automatically widens to i64
15    activation.insert("items", Value::list([1, 2, 3]));
16    activation.insert(
17        "config",
18        Value::map([("host", "localhost"), ("port", "8080")]),
19    );
20
21    // Extract i64
22    let ast = env.compile("count * 2").unwrap();
23    let program = env.program(&ast).unwrap();
24    let result = program.eval(&activation);
25
26    let value: i64 = (&result).try_into().expect("expected int");
27    println!("i64: {}", value);
28
29    // Extract bool
30    let ast = env.compile("count > 10").unwrap();
31    let program = env.program(&ast).unwrap();
32    let result = program.eval(&activation);
33
34    let value: bool = (&result).try_into().expect("expected bool");
35    println!("bool: {}", value);
36
37    // Extract &str
38    let ast = env.compile("config.host").unwrap();
39    let program = env.program(&ast).unwrap();
40    let result = program.eval(&activation);
41
42    let value: &str = (&result).try_into().expect("expected string");
43    println!("&str: {}", value);
44
45    // Extract &[Value] (list)
46    let ast = env.compile("items.filter(x, x > 1)").unwrap();
47    let program = env.program(&ast).unwrap();
48    let result = program.eval(&activation);
49
50    let list: &[Value] = (&result).try_into().expect("expected list");
51    println!("list length: {}", list.len());
52    for (i, v) in list.iter().enumerate() {
53        let n: i64 = v.try_into().expect("expected int");
54        println!("  [{}] = {}", i, n);
55    }
56
57    // Extract &ValueMap
58    let ast = env.compile("config").unwrap();
59    let program = env.program(&ast).unwrap();
60    let result = program.eval(&activation);
61
62    let map: &ValueMap = (&result).try_into().expect("expected map");
63    println!("map size: {}", map.len());
64    for (k, v) in map.iter() {
65        println!("  {:?} = {}", k, v);
66    }
67
68    // Handle errors gracefully
69    let result = Value::from("not an int");
70    let attempt: Result<i64, _> = (&result).try_into();
71    match attempt {
72        Ok(v) => println!("got: {}", v),
73        Err(e) => println!("conversion error: {}", e),
74    }
75
76    // Extract &OptionalValue
77    let opt_result = Value::optional_some(Value::from(99));
78    let opt: &OptionalValue = (&opt_result).try_into().expect("expected optional");
79    if opt.is_present() {
80        let inner: i64 = opt.as_value().unwrap().try_into().expect("expected int");
81        println!("optional value: {}", inner);
82    }
83}
Source

pub fn timestamp(seconds: i64, nanos: i32) -> Self

Create a timestamp value.

Source

pub fn duration(seconds: i64, nanos: i32) -> Self

Create a duration value.

Source

pub fn new_type(name: impl Into<Arc<str>>) -> Self

Create a type value.

Source

pub fn optional_none() -> Self

Create an optional none value.

Source

pub fn optional_some(value: Value) -> Self

Create an optional some value.

Examples found in repository?
examples/extract_values.rs (line 77)
7fn main() {
8    let env = Env::with_standard_library()
9        .with_variable("count", CelType::Int)
10        .with_variable("items", CelType::list(CelType::Int))
11        .with_variable("config", CelType::map(CelType::String, CelType::String));
12
13    let mut activation = MapActivation::new();
14    activation.insert("count", 42); // i32 automatically widens to i64
15    activation.insert("items", Value::list([1, 2, 3]));
16    activation.insert(
17        "config",
18        Value::map([("host", "localhost"), ("port", "8080")]),
19    );
20
21    // Extract i64
22    let ast = env.compile("count * 2").unwrap();
23    let program = env.program(&ast).unwrap();
24    let result = program.eval(&activation);
25
26    let value: i64 = (&result).try_into().expect("expected int");
27    println!("i64: {}", value);
28
29    // Extract bool
30    let ast = env.compile("count > 10").unwrap();
31    let program = env.program(&ast).unwrap();
32    let result = program.eval(&activation);
33
34    let value: bool = (&result).try_into().expect("expected bool");
35    println!("bool: {}", value);
36
37    // Extract &str
38    let ast = env.compile("config.host").unwrap();
39    let program = env.program(&ast).unwrap();
40    let result = program.eval(&activation);
41
42    let value: &str = (&result).try_into().expect("expected string");
43    println!("&str: {}", value);
44
45    // Extract &[Value] (list)
46    let ast = env.compile("items.filter(x, x > 1)").unwrap();
47    let program = env.program(&ast).unwrap();
48    let result = program.eval(&activation);
49
50    let list: &[Value] = (&result).try_into().expect("expected list");
51    println!("list length: {}", list.len());
52    for (i, v) in list.iter().enumerate() {
53        let n: i64 = v.try_into().expect("expected int");
54        println!("  [{}] = {}", i, n);
55    }
56
57    // Extract &ValueMap
58    let ast = env.compile("config").unwrap();
59    let program = env.program(&ast).unwrap();
60    let result = program.eval(&activation);
61
62    let map: &ValueMap = (&result).try_into().expect("expected map");
63    println!("map size: {}", map.len());
64    for (k, v) in map.iter() {
65        println!("  {:?} = {}", k, v);
66    }
67
68    // Handle errors gracefully
69    let result = Value::from("not an int");
70    let attempt: Result<i64, _> = (&result).try_into();
71    match attempt {
72        Ok(v) => println!("got: {}", v),
73        Err(e) => println!("conversion error: {}", e),
74    }
75
76    // Extract &OptionalValue
77    let opt_result = Value::optional_some(Value::from(99));
78    let opt: &OptionalValue = (&opt_result).try_into().expect("expected optional");
79    if opt.is_present() {
80        let inner: i64 = opt.as_value().unwrap().try_into().expect("expected int");
81        println!("optional value: {}", inner);
82    }
83}
Source

pub fn from_option<T: Into<Value>>(opt: Option<T>) -> Self

Convert an Option to a CEL optional value.

Unlike From<Option<T>> which maps None to Value::Null, this preserves CEL optional semantics.

use cel_core::Value;

let some_val = Value::from_option(Some(42));  // optional.of(42)
let none_val = Value::from_option(None::<i32>);  // optional.none()
Source

pub fn error(err: impl Into<EvalError>) -> Self

Create an error value.

Source§

impl Value

Source

pub fn cel_type(&self) -> CelType

Get the CEL type of this value.

Source

pub fn type_value(&self) -> TypeValue

Get the CEL type value for this value (for the type() function).

Source

pub fn is_error(&self) -> bool

Check if this value is an error.

Source

pub fn is_null(&self) -> bool

Check if this value is null.

Source

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

Check if this value is truthy (for bool values).

Returns Some(true) for proto messages since they are always truthy.

Source§

impl Value

Source

pub fn compare(&self, other: &Value) -> Option<Ordering>

Compare two values, returning an ordering if comparable.

CEL supports comparison between values of the same type, and between numeric types (int, uint, double).

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

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 Value

Source§

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

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

impl Display for Value

Source§

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

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

impl From<&[u8]> for Value

Source§

fn from(b: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Value

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<[u8]>> for Value

Source§

fn from(b: Arc<[u8]>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<str>> for Value

Source§

fn from(s: Arc<str>) -> Self

Converts to this type from the input type.
Source§

impl From<CelValue> for Value

Source§

fn from(cv: CelValue) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for Value

Source§

fn from(d: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<EvalError> for Value

Source§

fn from(e: EvalError) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<Timestamp> for Value

Source§

fn from(t: Timestamp) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Value>> for Value

Source§

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

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Value

Source§

fn from(b: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Value

Source§

fn from(d: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(i: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(i: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(i: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(i: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Value

Source§

fn from(i: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(u: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(u: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(u: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(u: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Value

Source§

fn from(u: usize) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Value

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.
Source§

impl<'a> TryFrom<&'a Value> for &'a [Value]

Source§

type Error = ValueError

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

fn try_from(v: &'a Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a [u8]

Source§

type Error = ValueError

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

fn try_from(v: &'a Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a EvalError

Source§

type Error = ValueError

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

fn try_from(v: &'a Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a OptionalValue

Source§

type Error = ValueError

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

fn try_from(v: &'a Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a ValueMap

Source§

type Error = ValueError

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

fn try_from(v: &'a Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a Value> for &'a str

Source§

type Error = ValueError

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

fn try_from(v: &'a Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Value> for Duration

Source§

type Error = ValueError

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Value> for Timestamp

Source§

type Error = ValueError

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Value> for bool

Source§

type Error = ValueError

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Value> for f64

Source§

type Error = ValueError

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Value> for i64

Source§

type Error = ValueError

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Value> for u64

Source§

type Error = ValueError

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

fn try_from(v: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Duration

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for String

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Timestamp

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for bool

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for f64

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for i64

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for u64

Source§

type Error = ValueError

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

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Value

§

impl !RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl !UnwindSafe for Value

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.