[][src]Function packs::extract_list_ref

pub fn extract_list_ref<S, T: ExtractRef<S>>(
    value: &Value<S>
) -> Option<Vec<&T>>

Extracts a Value::List with the same runtime type values into a vector of extracted values.

let value : Value<NoStruct> = vec!(42, -1, 3332).into_iter().collect();

let ints = extract_list_ref::<NoStruct, i64>(&value);
assert_eq!(Some(vec!(&42, &-1, &3332)), ints);

Does return None whenever either the provided value is not a List or any of the items of the list cannot be extracted to T.

let value : Value<NoStruct> =
    vec!(
        Value::Integer(42),
        Value::Boolean(false))
    .into_iter().collect();

let extract = extract_list_ref::<NoStruct, i64>(&value);
assert_eq!(None, extract);