pub struct JSONGetTextBuilder<'a> { /* private fields */ }
Expand description

To build a JSONGetText instance, this struct can help you do that step by step.

Implementations§

source§

impl<'a> JSONGetTextBuilder<'a>

source

pub fn new<S: Into<String>>(default_key: S) -> JSONGetTextBuilder<'a>

Create a new JSONGetTextBuilder instance. You need to decide your default key at the stage.

source

pub fn add_json<K: AsRef<str> + Into<String>, J: AsRef<str> + ?Sized>( &mut self, key: K, json: &'a J ) -> Result<&mut Self, JSONGetTextBuildError>

Add a JSON string to the context for a specify key. The JSON string must represent a map object (key-value).

source

pub fn add_json_owned<K: AsRef<str> + Into<String>, J: AsRef<str>>( &mut self, key: K, json: J ) -> Result<&mut Self, JSONGetTextBuildError>

Add a JSON string to the context for a specify key. The JSON string must represent a map object (key-value).

source

pub fn add_json_file<K: AsRef<str> + Into<String>, P: AsRef<Path>>( &mut self, key: K, path: P ) -> Result<&mut Self, JSONGetTextBuildError>

Add a JSON file to the context for a specify key. The JSON file must represent a map object (key-value).

source

pub fn add_serialize<K: AsRef<str> + Into<String>, S: Serialize>( &mut self, key: K, value: S ) -> Result<&mut Self, JSONGetTextBuildError>

Add any serializable value to the context for a specify key. The value must represent a map object (key-value).

source

pub fn add_map<K: AsRef<str> + Into<String>>( &mut self, key: K, map: HashMap<String, JSONGetTextValue<'a>> ) -> Result<&mut Self, JSONGetTextBuildError>

Add a map to the context.

source

pub fn build(self) -> Result<JSONGetText<'a>, JSONGetTextBuildError>

Build a JSONGetText instance.

Trait Implementations§

source§

impl<'a> Clone for JSONGetTextBuilder<'a>

source§

fn clone(&self) -> JSONGetTextBuilder<'a>

Returns a copy 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<'a> Debug for JSONGetTextBuilder<'a>

source§

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

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

impl<'a> From<String> for JSONGetTextBuilder<'a>

source§

fn from(v: String) -> JSONGetTextBuilder<'a>

Converts to this type from the input type.

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> ToOwned for T
where T: Clone,

§

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

§

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.