[][src]Enum nash_protocol::protocol::ResponseOrError

pub enum ResponseOrError<T> {
    Response(DataResponse<T>),
    Error(ErrorResponse),
}

Wrapper type to account for GraphQL errors

Variants

Response(DataResponse<T>)

Implementations

impl<T> ResponseOrError<T>[src]

pub fn from_data(data: T) -> Self[src]

Build from data

pub fn consume_match(self) -> ErrorOrData<T>[src]

pub fn response(&self) -> Option<&T>[src]

Get response from wrapper if it exists

pub fn consume_response(self) -> Option<T>[src]

Get response from wrapper if it exists, will destroy wrapper

pub fn consume_error(self) -> Option<ErrorResponse>[src]

pub fn response_or_error(self) -> Result<T>[src]

Get response or else error

pub fn error(&self) -> Option<&ErrorResponse>[src]

Get error from wrapper if it exists

pub fn is_error(&self) -> bool[src]

Is the response a GraphQL error?

pub fn map<M>(self, f: Box<dyn Fn(T) -> M>) -> ResponseOrError<M>[src]

Transform the inner value of a valid response. Will not transform an error

Trait Implementations

impl<T: Debug> Debug for ResponseOrError<T>[src]

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

impl<T> Serialize for ResponseOrError<T> where
    T: Serialize
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for ResponseOrError<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for ResponseOrError<T> where
    T: Send
[src]

impl<T> Sync for ResponseOrError<T> where
    T: Sync
[src]

impl<T> Unpin for ResponseOrError<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for ResponseOrError<T> where
    T: UnwindSafe
[src]

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

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

impl<T> FmtForward for T

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

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

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

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.