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