Fluent

Struct Fluent 

Source
pub struct Fluent { /* private fields */ }

Implementations§

Source§

impl Fluent

Source

pub fn new() -> Self

Create a new fluent instance.

Source

pub fn make() -> Self

Create a new fluent instance.

Proxies to Fluent::new()

Source

pub fn from(attributes: HashMap<String, Value>) -> Self

Create a fluent instance from the given attributes.

Source

pub fn set(&mut self, key: &str, value: impl Into<Value>)

Set an attribute on the fluent instance using “dot” notation.

Source

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

Get an attribute from the fluent instance using “dot” notation.

Source

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

Get a value off the instance and cast to str.

Source

pub fn fill(&mut self, attributes: HashMap<String, Value>) -> &mut Self

Fill the fluent instance with the attributes.

Source

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

Does the “key” exist on the fluent instance?

Source

pub fn all(&self) -> &HashMap<String, Value>

Get all attributes of the fluent instance

Source

pub fn value(&self, key: &str, default: Value) -> Value

Get and attribute from the fluent instance.

Source

pub fn scope(&self, key: &str, default: Value) -> Self

Wrap the value of key in a new fluent instance.

Source

pub fn get_attributes(&self) -> &HashMap<String, Value>

Get the attributes on the fluent instance.

Source

pub fn set_from_option(&mut self, key: &str, value: Option<impl Into<Value>>)

Insert an optional value into the Fluent instance. If the value is Some, insert it as-is. If None, insert serde_json::Value::Null.

Trait Implementations§

Source§

impl Arrayable for Fluent

Source§

impl Clone for Fluent

Source§

fn clone(&self) -> Fluent

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 Fluent

Source§

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

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

impl Default for Fluent

Source§

fn default() -> Fluent

Returns the “default value” for a type. Read more
Source§

impl Index<&str> for Fluent

Source§

type Output = Value

The returned type after indexing.
Source§

fn index(&self, key: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<&str> for Fluent

Source§

fn index_mut(&mut self, key: &str) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl JsonSerializable for Fluent

Source§

impl Jsonable for Fluent

Source§

impl PartialEq for Fluent

Source§

fn eq(&self, other: &Fluent) -> 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 Vectorable for Fluent

Source§

type T = Value

Source§

fn to_vec(&self) -> Vec<Value>

Source§

impl Eq for Fluent

Source§

impl StructuralPartialEq for Fluent

Auto Trait Implementations§

§

impl Freeze for Fluent

§

impl RefUnwindSafe for Fluent

§

impl Send for Fluent

§

impl Sync for Fluent

§

impl Unpin for Fluent

§

impl UnwindSafe for Fluent

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