1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

move promise to its own crate

This commit is contained in:
Wez Furlong 2019-03-04 15:38:56 +00:00
parent 3ae0f7d110
commit 1d37e44b62
7 changed files with 15 additions and 8 deletions

View File

@ -29,6 +29,7 @@ foreign-types = "0.3"
winit = "0.18"
boxfnonce = "0.1"
rayon = "1.0"
promise = { path = "promise" }
[target.'cfg(unix)'.dependencies]
harfbuzz-sys = "~0.3"

10
promise/Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
authors = ["Wez Furlong <wez@wezfurlong.org>"]
name = "promise"
version = "0.1.0"
edition = "2018"
[dependencies]
failure = "0.1"
boxfnonce = "0.1"
rayon = "1.0"

View File

@ -33,7 +33,6 @@ enum PromiseState<T> {
enum FutureState<T> {
Waiting(Arc<Core<T>>),
Ready(Result<T, Error>),
Done,
}
struct CoreData<T> {
@ -151,7 +150,6 @@ impl<T: Send + 'static> Future<T> {
fn chain(self, f: NextFunc<T>) {
match self.state {
FutureState::Done => panic!("chaining an already done future"),
FutureState::Ready(result) => {
f.call(result);
}
@ -179,7 +177,6 @@ impl<T: Send + 'static> Future<T> {
}
}
FutureState::Ready(result) => result,
FutureState::Done => bail!("Future is already done"),
}
}

View File

@ -6,15 +6,15 @@ use crate::gliumwindows;
pub use crate::gliumwindows::GliumTerminalWindow;
use crate::guicommon::tabs::Tab;
use crate::guicommon::window::TerminalWindow;
use crate::guiloop::{GuiSelection, SessionTerminated};
use crate::guiloop::SessionTerminated;
use crate::mux::{Mux, PtyEvent, PtyEventSender};
use crate::promise::{Executor, Future, SpawnFunc};
use crate::spawn_tab;
use failure::Error;
use futures::future;
use glium;
use glium::glutin::EventsLoopProxy;
pub use glium::glutin::WindowId;
use promise::{Executor, Future, SpawnFunc};
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;

View File

@ -3,8 +3,8 @@ use crate::config::Config;
use crate::font::FontConfiguration;
use crate::guicommon::tabs::Tab;
use crate::mux::{Mux, PtyEventSender};
use crate::promise::Executor;
use failure::Error;
use promise::Executor;
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc;

View File

@ -5,13 +5,13 @@ use crate::guicommon::tabs::Tab;
use crate::guicommon::window::TerminalWindow;
use crate::guiloop::GuiSystem;
use crate::mux::{Mux, PtyEvent, PtyEventSender};
use crate::promise::{Executor, SpawnFunc};
use crate::spawn_tab;
use crate::xwindows::xwin::X11TerminalWindow;
use crate::xwindows::Connection;
use failure::Error;
use mio::{Events, Poll, PollOpt, Ready, Token};
use mio_extras::channel::{channel, Receiver as GuiReceiver, Sender as GuiSender};
use promise::{Executor, SpawnFunc};
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;

View File

@ -22,7 +22,6 @@ mod guicommon;
mod guiloop;
mod mux;
mod opengl;
mod promise;
mod server;
use crate::guicommon::tabs::Tab;
use crate::guiloop::GuiSelection;