[−][src]Struct redbot::Config
Program configuration - contains the required values to communicate with the Reddit OAuth API for a token.
The username
and password
fields are the same login
strings that you'd use to log into the account on the
Reddit website. The user_agent
field is for setting
the 'User Agent' header value to use when communicating
with the API, as per the API usage requirements.
The client_id
and client_secret
fields are for a
'script' type application that you create on the Reddit
website.
Fields
username: String
Account username
password: String
Account password
user_agent: String
User agent to use
client_id: String
App client id
client_secret: String
App client secret
Methods
impl Config
[src]
pub fn load_config(path: &str) -> Result<Self, ApiError>
[src]
Attempt to load the configuration from a file.
Arguments
path
- relative path to the file
Examples
A file called 'config.json' is has the content:
{
"username": "my-bot-account",
"password": "hunter2",
"user_agent": "linux:reddit-rust:v.0.0.1 (bot by /u/my-main-account)",
"client_id": "foo",
"client_secret": "bar"
}
Retrieve the config with:
let config = Config::load_config("config.json")?;
Trait Implementations
impl PartialEq<Config> for Config
[src]
impl Clone for Config
[src]
fn clone(&self) -> Config
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Config
[src]
impl<'de> Deserialize<'de> for Config
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,