Builder

Struct Builder 

Source
pub struct Builder;

Implementations§

Source§

impl Builder

Source

pub fn new(operation: OperationType, selection_set: &SelectionSet) -> String

Examples found in repository?
examples/simple-operation.rs (line 24)
3pub fn query() -> String {
4    let story = SelectionSet {
5        operation: "Story",
6        alias: None,
7        fields: Some(vec![SelectionSet {
8            operation: "likeCount",
9            alias: None,
10            fields: None,
11            arguments: None,
12            is_union: false,
13        }]),
14        arguments: None,
15        is_union: false,
16    };
17    let like_story = SelectionSet {
18        operation: "likeStory",
19        alias: None,
20        fields: Some(vec![story]),
21        arguments: json!({ "storyID": 12345 }),
22        is_union: false,
23    };
24    Builder::new(OperationType::Mutation, &like_story)
25}
More examples
Hide additional examples
examples/field-alias.rs (line 41)
3pub fn query() -> String {
4    let vec = vec![
5        SelectionSet {
6            operation: "id",
7            alias: None,
8            fields: None,
9            arguments: None,
10            is_union: false,
11        },
12        SelectionSet {
13            operation: "name",
14            alias: None,
15            fields: None,
16            arguments: None,
17            is_union: false,
18        },
19        SelectionSet {
20            operation: "profilePic",
21            alias: Some("smallPic"),
22            fields: None,
23            arguments: None,
24            is_union: false,
25        },
26        SelectionSet {
27            operation: "profilePic",
28            alias: Some("bigPic"),
29            fields: None,
30            arguments: None,
31            is_union: false,
32        },
33    ];
34    let user = SelectionSet {
35        operation: "user",
36        alias: None,
37        fields: Some(vec),
38        arguments: json!({ "id": 4 }),
39        is_union: false,
40    };
41    Builder::new(OperationType::Query, &user)
42}

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