Struct egg_mode::Response[][src]

pub struct Response<T> {
    pub rate_limit_status: RateLimit,
    pub response: T,
}
Expand description

A helper struct to wrap response data with accompanying rate limit information.

This is returned by any function that calls a rate-limited method on Twitter, to allow for inline checking of the rate-limit information without an extra call to service::rate_limit_info.

As this implements Deref and DerefMut, you can transparently use the contained response’s methods as if they were methods on this struct.

Fields

rate_limit_status: RateLimit

The latest rate-limit information returned with the request.

response: T

The decoded response from the request.

Implementations

Convert a Response<T> to a Response<U> by running its contained response through the given function. This preserves its rate-limit information.

Note that this is not a member function, so as to not conflict with potential methods on the contained T.

Attempt to convert a Response<T> into a Response<U> by running its contained response through the given function, preserving its rate-limit information. If the conversion function fails, an error is returned instead.

Note that this is not a member function, so as to not conflict with potential methods on the contained T.

Converts a Response<T> into a Response<U> using the Into trait.

This is implemented as a type function instead of the From/Into trait due to implementation conflicts with the From<T> for T implementation in the standard library. It is also implemented as a function directly on the Response type instead of as a member function to not clash with the into() function that would be available on the contained T.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.