Struct orca::net::Connection [−][src]
pub struct Connection { pub auth: Option<OAuth>, pub useragent: UserAgent, pub client: Client<HttpsConnector<HttpConnector>, Body>, pub limit: Cell<LimitMethod>, // some fields omitted }
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: UserAgent
User agent for the client
client: Client<HttpsConnector<HttpConnector>, Body>
HTTP client
limit: Cell<LimitMethod>
How to ratelimit (burst or steady)
Methods
impl Connection
[src]
impl Connection
pub fn new(
appname: &str,
appversion: &str,
appauthor: &str
) -> Result<Connection, Error>
[src]
pub fn new(
appname: &str,
appversion: &str,
appauthor: &str
) -> Result<Connection, Error>
Creates a new connection instance to reddit
Arguments
appname
- The name of the appappversion
- The version of the appappauthor
- The author of the app (should be in reddit form as /u/)
pub fn run_request(&self, req: Request) -> Result<Value, Error>
[src]
pub fn run_request(&self, req: Request) -> Result<Value, Error>
Send a request to reddit. This is where ratelimiting happens, as well as setting the user agent.
pub fn run_auth_request(&self, req: Request) -> Result<Value, Error>
[src]
pub fn run_auth_request(&self, req: Request) -> Result<Value, Error>
Send a request to reddit with authorization headers
pub fn set_limit(&self, limit: LimitMethod)
[src]
pub fn set_limit(&self, limit: LimitMethod)
Set's the ratelimiting method
pub fn get_core(&self) -> &RefCell<Core>
[src]
pub fn get_core(&self) -> &RefCell<Core>
Returns a reference to the tokio core in a RefCell
Auto Trait Implementations
impl !Send for Connection
impl !Send for Connection
impl !Sync for Connection
impl !Sync for Connection