[][src]Struct fastly::Dictionary

pub struct Dictionary { /* fields omitted */ }

A Compute@Edge Dictionary.

Implementations

impl Dictionary[src]

pub fn open(name: &str) -> Self[src]

Open a dictionary, given its name.

Examples

let merriam = Dictionary::open("merriam webster");
let oed = Dictionary::open("oxford english dictionary");

pub fn get(&self, key: &str) -> Option<String>[src]

Lookup a value in this dictionary.

If successful, this function returns Some(_) if an entry was found, or None if no entry with the given key was found.

Examples

assert_eq!(
     dictionary.get("bread"),
     Some(String::from("a usually baked and leavened food")),
);
assert_eq!(
    dictionary.get("freedom"),
    Some(String::from("the absence of necessity, coercion, or constraint")),
);

// Otherwise, `get` will return nothing.
assert!(dictionary.get("zzzzz").is_none());

pub fn contains(&self, key: &str) -> bool[src]

Return true if the dictionary contains an entry with the given key.

Examples

assert!(dictionary.contains("key"));

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.