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: RateLimitThe latest rate-limit information returned with the request.
response: TThe 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
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Response<T> where
T: RefUnwindSafe, impl<T> UnwindSafe for Response<T> where
T: UnwindSafe,