Trait teloxide::requests::HasPayload[][src]

pub trait HasPayload {
    type Payload: Payload;
    pub fn payload_mut(&mut self) -> &mut Self::Payload;
pub fn payload_ref(&self) -> &Self::Payload; }

Represents types having payload inside.

This trait is something between DerefMut and BorrowMut — it allows only one implementation per type (the output type is associated, not generic), has implementations for all types P such P: Payload, but has no magic compiler support like DerefMut does nor does it require any laws about Eq, Ord and Hash as BorrowMut does.

Also the output type is bounded by the Payload trait.

This trait is mostly used to implement payload setters (on both payloads & requests), so you probably won’t find yourself using it directly.

Associated Types

type Payload: Payload[src]

The type of the payload contained.

Loading content...

Required methods

pub fn payload_mut(&mut self) -> &mut Self::Payload[src]

Gain mutable access to the underlying payload.

pub fn payload_ref(&self) -> &Self::Payload[src]

Gain immutable access to the underlying payload.

Loading content...

Implementors

impl<P> HasPayload for JsonRequest<P> where
    P: Payload
[src]

type Payload = P

impl<P> HasPayload for MultipartRequest<P> where
    P: Payload
[src]

type Payload = P

impl<P> HasPayload for P where
    P: Payload
[src]

type Payload = P

impl<R> HasPayload for AutoRequest<R> where
    R: Request
[src]

type Payload = <R as HasPayload>::Payload

impl<R> HasPayload for CachedMeRequest<R> where
    R: Request<Payload = GetMe>, 
[src]

type Payload = GetMe

impl<R> HasPayload for ThrottlingRequest<R> where
    R: HasPayload
[src]

type Payload = <R as HasPayload>::Payload

Loading content...