Enum gtmpl_value::Value[][src]

pub enum Value {
    NoValue,
    Nil,
    Bool(bool),
    String(String),
    Object(HashMap<String, Value>),
    Map(HashMap<String, Value>),
    Array(Vec<Value>),
    Function(Function),
    Number(Number),
}

Represents a gtmpl value.

Variants

Methods

impl Value
[src]

Trait Implementations

impl From<i8> for Value
[src]

Performs the conversion.

impl From<i16> for Value
[src]

Performs the conversion.

impl From<i32> for Value
[src]

Performs the conversion.

impl From<i64> for Value
[src]

Performs the conversion.

impl From<isize> for Value
[src]

Performs the conversion.

impl From<u8> for Value
[src]

Performs the conversion.

impl From<u16> for Value
[src]

Performs the conversion.

impl From<u32> for Value
[src]

Performs the conversion.

impl From<u64> for Value
[src]

Performs the conversion.

impl From<usize> for Value
[src]

Performs the conversion.

impl From<f32> for Value
[src]

Performs the conversion.

impl From<f64> for Value
[src]

Performs the conversion.

impl From<bool> for Value
[src]

Convert boolean to Value

Examples

use gtmpl_value::Value;

let b = false;
let x: Value = b.into();

impl<'a> From<&'a String> for Value
[src]

Convert &String to Value

Examples

use gtmpl_value::Value;

let s: &String = &"foobar".to_owned();
let x: Value = s.into();

impl From<String> for Value
[src]

Convert String to Value

Examples

use gtmpl_value::Value;

let s: String = "foobar".to_owned();
let x: Value = s.into();

impl<'a> From<&'a str> for Value
[src]

Convert &str to Value

Examples

use gtmpl_value::Value;

let s = "foobar";
let x: Value = s.into();

impl<'a> From<Cow<'a, str>> for Value
[src]

Convert Cow to Value

Examples

use gtmpl_value::Value;
use std::borrow::Cow;

let s: Cow<str> = Cow::Borrowed("foobar");
let x: Value = s.into();

impl From<Func> for Value
[src]

Convert Func to Value

Examples

use gtmpl_value::{Func, Value};

fn f(a: &[Value]) -> Result<Value, String> {
    Ok(a[0].clone())
};
let x: Value = (f as Func).into();

impl<T> From<Vec<T>> for Value where
    T: Into<Value> + Clone
[src]

Convert Vec to Value

Examples

use gtmpl_value::Value;

let v = vec!(1, 2, 3);
let x: Value = v.into();

impl<'a, T> From<&'a [T]> for Value where
    T: Into<Value> + Clone
[src]

Convert Slice to Value

Examples

use gtmpl_value::Value;

let v: &[i32] = &[1, 2, 3];
let x: Value = v.into();

impl<T> From<HashMap<String, T>> for Value where
    T: Into<Value> + Clone
[src]

Convert HashMap<String, T> to Value

Examples

use gtmpl_value::Value;
use std::collections::HashMap;

let mut m = HashMap::new();
m.insert("hello".to_owned(), 123);
let x: Value = m.into();

impl Clone for Value
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Value
[src]

Formats the value using the given formatter. Read more

impl PartialEq for Value
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Display for Value
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Value

impl Sync for Value