Struct fastly::Dictionary

source ·
pub struct Dictionary { /* private fields */ }
👎Deprecated since 0.8.6: renamed to ConfigStore
Expand description

A Compute Dictionary.

Implementations§

source§

impl Dictionary

source

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

👎Deprecated since 0.8.6: use method on ConfigStore instead

Open a dictionary, given its name.

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

pub fn try_open(name: &str) -> Result<Self, OpenError>

👎Deprecated since 0.8.6: use method on ConfigStore instead

Try to open a dictionary, given its name.

§Examples
let merriam = Dictionary::try_open("merriam webster").unwrap();
source

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

👎Deprecated since 0.8.6: use method on ConfigStore instead

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());
§Panics

This may panic for any of the reasons that Dictionary::try_get would return an error.

source

pub fn try_get(&self, key: &str) -> Result<Option<String>, LookupError>

👎Deprecated since 0.8.6: use method on ConfigStore instead

Try to lookup a value in this dictionary.

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

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

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

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

👎Deprecated since 0.8.6: use method on ConfigStore instead

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

§Examples
assert!(dictionary.contains("key"));
§Panics

This may panic for any of the reasons that Dictionary::try_get would return an error.

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.