Struct orca::net::Connection

source ·
pub struct Connection {
    pub auth: Option<OAuth>,
    pub useragent: HeaderValue,
    pub client: Client<HttpsConnector<HttpConnector>, Body>,
    pub limit: Cell<LimitMethod>,
    /* private fields */
}
Expand description

A connection holder to reddit. Holds authorization info if provided, and is in charge of ratelimiting.

Fields§

§auth: Option<OAuth>

Authorization info (optional, but required for sending authorized requests)

§useragent: HeaderValue

User agent for the client

§client: Client<HttpsConnector<HttpConnector>, Body>

HTTP client

§limit: Cell<LimitMethod>

How to ratelimit (burst or steady)

Implementations§

Creates a new connection instance to reddit

Arguments
  • appname - The name of the app
  • appversion - The version of the app
  • appauthor - The author of the app (should be in reddit form as /u/)

Send a request to reddit. This is where ratelimiting happens, as well as setting the user agent.

Send a request to reddit with authorization headers

Set’s the ratelimiting method

Returns a reference to the tokio core in a RefCell

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.