Data

Struct Data 

Source
pub struct Data {
    pub data: Vec<(&'static str, &'static str)>,
}

Fields§

§data: Vec<(&'static str, &'static str)>

Implementations§

Source§

impl Data

Source

pub fn new() -> Self

Examples found in repository?
examples/create_group.rs (line 9)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let data: Data = Data::new().add("name", "Dummy Group");
10
11    let response: Response = mailerlite.group().create(data.clone()).await;
12
13    println!("{:#?}", response);
14}
More examples
Hide additional examples
examples/create_subsciber.rs (line 9)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let data: Data = Data::new().add("email", "john@gmail.com");
10
11    let response: Response = mailerlite.subscriber().create(data.clone()).await;
12
13    println!("{:#?}", response);
14}
examples/create_field.rs (line 9)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let data: Data = Data::new().add("name", "Dummy Field").add("type", "text");
10
11    let response: Response = mailerlite.field().create(data.clone()).await;
12
13    println!("{:#?}", response);
14}
examples/update_form.rs (line 11)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let id: String = String::from("Your Form ID");
10
11    let data: Data = Data::new().add("name", "Dummy Form");
12
13    let response: Response = mailerlite.form().update(id, data.clone()).await;
14
15    println!("{:#?}", response);
16}
examples/update_field.rs (line 11)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let id: String = String::from("Your Field ID");
10
11    let data: Data = Data::new().add("name", "Dummy Field");
12
13    let response: Response = mailerlite.field().update(id, data.clone()).await;
14
15    println!("{:#?}", response);
16}
examples/update_group.rs (line 11)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let id: String = String::from("Your Group ID");
10
11    let data: Data = Data::new().add("name", "Dummy Group");
12
13    let response: Response = mailerlite.group().update(id, data.clone()).await;
14
15    println!("{:#?}", response);
16}
Source

pub fn add(self, key: &'static str, value: &'static str) -> Self

Examples found in repository?
examples/create_group.rs (line 9)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let data: Data = Data::new().add("name", "Dummy Group");
10
11    let response: Response = mailerlite.group().create(data.clone()).await;
12
13    println!("{:#?}", response);
14}
More examples
Hide additional examples
examples/create_subsciber.rs (line 9)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let data: Data = Data::new().add("email", "john@gmail.com");
10
11    let response: Response = mailerlite.subscriber().create(data.clone()).await;
12
13    println!("{:#?}", response);
14}
examples/create_field.rs (line 9)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let data: Data = Data::new().add("name", "Dummy Field").add("type", "text");
10
11    let response: Response = mailerlite.field().create(data.clone()).await;
12
13    println!("{:#?}", response);
14}
examples/update_form.rs (line 11)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let id: String = String::from("Your Form ID");
10
11    let data: Data = Data::new().add("name", "Dummy Form");
12
13    let response: Response = mailerlite.form().update(id, data.clone()).await;
14
15    println!("{:#?}", response);
16}
examples/update_field.rs (line 11)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let id: String = String::from("Your Field ID");
10
11    let data: Data = Data::new().add("name", "Dummy Field");
12
13    let response: Response = mailerlite.field().update(id, data.clone()).await;
14
15    println!("{:#?}", response);
16}
examples/update_group.rs (line 11)
4async fn main() {
5    let api_key: String = String::from("Your MailerLite API Key");
6
7    let mailerlite: MailerLite = MailerLite::new(api_key);
8
9    let id: String = String::from("Your Group ID");
10
11    let data: Data = Data::new().add("name", "Dummy Group");
12
13    let response: Response = mailerlite.group().update(id, data.clone()).await;
14
15    println!("{:#?}", response);
16}
Source

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

Trait Implementations§

Source§

impl Clone for Data

Source§

fn clone(&self) -> Data

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 Data

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Data

§

impl RefUnwindSafe for Data

§

impl Send for Data

§

impl Sync for Data

§

impl Unpin for Data

§

impl UnwindSafe for Data

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more