pub struct Config { /* private fields */ }
Expand description
Config for the IRC client
For more information about what arguments the IRC commands take, see commands::Command
.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(
channels: &[&'static str],
host: &str,
mode: Option<&'static str>,
nickname: Option<&'static str>,
port: u16,
username: &str,
) -> Self
pub fn new( channels: &[&'static str], host: &str, mode: Option<&'static str>, nickname: Option<&'static str>, port: u16, username: &str, ) -> Self
Create a new config for the client
§Example
let config = Config::new(
&["#chaos", "#async-circe"],
"karx.xyz",
Some("+B"),
Some("async-circe"),
6697,
"circe",
);
Sourcepub fn runtime_config(
channels: Vec<String>,
host: String,
mode: Option<String>,
nickname: Option<String>,
port: u16,
username: String,
) -> Self
pub fn runtime_config( channels: Vec<String>, host: String, mode: Option<String>, nickname: Option<String>, port: u16, username: String, ) -> Self
Allows for configuring async-circe at runtime.
§Example
# use async_circe::Config;
let config = Config::runtime_config(
vec!["#chaos".to_string(), "#async-circe".to_string()],
"karx.xyz".to_string(),
Some("+B".to_string()),
Some("async-circe".to_string()),
6697,
"circe".to_string(),
);
Sourcepub fn from_toml<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Available on crate feature toml_config
only.
pub fn from_toml<P: AsRef<Path>>(path: P) -> Result<Self, Error>
toml_config
only.Create a config from a toml file
§Example
#Config.toml
channels = ["#chaos", "#async-circe"]
host = "karx.xyz"
mode = "+B"
nickname = "async-circe"
port = 6667
username = "circe"
let config = Config::from_toml("Config.toml")?;
§Errors
Returns an Error if the file cannot be opened or if the TOML is invalid
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§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 Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more