This commit is contained in:
parent
b94147fa8c
commit
5eae79df03
@ -27,6 +27,17 @@ pub struct Config {
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn init() -> Self {
|
||||
let mut c = Config {
|
||||
pseudo: Some("".into()),
|
||||
channel: Some("".into()),
|
||||
set_theme: Some(false),
|
||||
enc: Some(false),
|
||||
enc_key: Some("".into()),
|
||||
};
|
||||
c.load();
|
||||
c
|
||||
}
|
||||
pub fn new(pseudo: &str, channel: &str, set_theme: bool, enc: bool, enc_key: &str) -> Self {
|
||||
Config {
|
||||
pseudo: Some(pseudo.to_string()),
|
||||
|
14
src/main.rs
14
src/main.rs
@ -13,20 +13,22 @@ use tokio::runtime::Runtime;
|
||||
use tokio::sync::mpsc::*;
|
||||
use tokio::sync::*;
|
||||
|
||||
fn main() {
|
||||
let mut cfg: Config = Config::new("", "", false, false, "");
|
||||
cfg.load();
|
||||
const DEFAULT_CHAN_SIZE: usize = 10;
|
||||
|
||||
fn main() {
|
||||
let cfg = Config::init();
|
||||
let mut c = window::new_window();
|
||||
|
||||
let (app_to_net_s, app_to_net_r): (Sender<Vec<u8>>, Receiver<Vec<u8>>) = channel(10);
|
||||
let (net_to_app_s, net_to_app_r): (Sender<Vec<u8>>, Receiver<Vec<u8>>) = channel(10);
|
||||
let (app_to_net_s, app_to_net_r): (Sender<Vec<u8>>, Receiver<Vec<u8>>) =
|
||||
channel(DEFAULT_CHAN_SIZE);
|
||||
let (net_to_app_s, net_to_app_r): (Sender<Vec<u8>>, Receiver<Vec<u8>>) =
|
||||
channel(DEFAULT_CHAN_SIZE);
|
||||
|
||||
let net_to_app_r = Arc::new(RwLock::new(net_to_app_r));
|
||||
let net_to_app_s = Arc::new(RwLock::new(net_to_app_s));
|
||||
let app_to_net_r = Arc::new(RwLock::new(app_to_net_r));
|
||||
|
||||
let ctx: Context = Context::new(cfg, app_to_net_s);
|
||||
let ctx = Context::new(cfg, app_to_net_s);
|
||||
let window_ctx = Arc::new(RwLock::new(ctx));
|
||||
let wctx_window = Arc::clone(&window_ctx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user