[][src]Struct warpgrapher::engine::config::Endpoint

pub struct Endpoint { /* fields omitted */ }

Configuration item for custom endpoints

Examples


let e = Endpoint::new("CountItems".to_string(), EndpointClass::Query, None,
    EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true));

Implementations

impl Endpoint[src]

pub fn new(
    name: String,
    class: EndpointClass,
    input: Option<EndpointType>,
    output: EndpointType
) -> Endpoint
[src]

Creates a new configuration item for a custom GraphQL endpoint

Examples


let e = Endpoint::new("CountItems".to_string(), EndpointClass::Query, None,
    EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true));

pub fn class(&self) -> &EndpointClass[src]

Returns the EndpointClass of a custom GraphQL endpoint, indicating whether the custom endpoint is a Query or Mutation.

Examples


let e = Endpoint::new("CountItems".to_string(), EndpointClass::Query, None,
    EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true));

assert_eq!(&EndpointClass::Query, e.class());

pub fn name(&self) -> &str[src]

Returns the name of a custom GraphQL endpoint.

Examples


let e = Endpoint::new("CountItems".to_string(), EndpointClass::Query, None,
    EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true));

assert_eq!("CountItems", e.name());

pub fn input(&self) -> Option<&EndpointType>[src]

Returns the optional type definition of the input to a custom endpoint. A value of None indicates that the GraphQL endpoint does not take an input.

Examples


let e = Endpoint::new("CountItems".to_string(), EndpointClass::Query, None,
    EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true));

assert!(e.input().is_none());

pub fn output(&self) -> &EndpointType[src]

Returns the type definition of the output for a custom endpoint

Examples


let e = Endpoint::new("CountItems".to_string(), EndpointClass::Query, None,
    EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true));

assert_eq!(&EndpointType::new(TypeDef::Scalar(GraphqlType::Int), false, true),
    e.output());

Trait Implementations

impl Clone for Endpoint[src]

impl Debug for Endpoint[src]

impl<'de> Deserialize<'de> for Endpoint[src]

impl Eq for Endpoint[src]

impl Hash for Endpoint[src]

impl Ord for Endpoint[src]

impl PartialEq<Endpoint> for Endpoint[src]

impl PartialOrd<Endpoint> for Endpoint[src]

impl Serialize for Endpoint[src]

impl StructuralEq for Endpoint[src]

impl StructuralPartialEq for Endpoint[src]

impl<'_> TryFrom<&'_ str> for Endpoint[src]

type Error = Error

The type returned in the event of a conversion error.

pub fn try_from(yaml: &str) -> Result<Endpoint, Error>[src]

Creates a new Endpoint struct from a yaml-formatted string.

Errors

Returns an Error variant DeserializationFailed if the yaml-formatted string is improperly formatted.

Examples

use warpgrapher::engine::config::{Endpoint};

use std::convert::TryFrom;
let t = Endpoint::try_from("
name: RegisterUser
class: Mutation
input:
  type: UserInput
output:
  type: User
").unwrap();

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,