1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

more explicit dyn for windows

This commit is contained in:
Wez Furlong 2019-09-23 06:46:56 -07:00
parent 8e38f34b6d
commit 190303c7d5
3 changed files with 10 additions and 10 deletions

View File

@ -208,7 +208,7 @@ impl PtySystemSelection {
/// Construct an instance of PtySystem described by the enum value.
/// Windows specific enum variants result in an error.
#[cfg(unix)]
pub fn get(self) -> Result<Box<dyn PtySystem>, Error> {
pub fn get(self) -> Fallible<Box<dyn PtySystem>> {
match self {
PtySystemSelection::Unix => Ok(Box::new(unix::UnixPtySystem {})),
_ => bail!("{:?} not available on unix", self),
@ -218,7 +218,7 @@ impl PtySystemSelection {
/// Construct an instance of PtySystem described by the enum value.
/// Unix specific enum variants result in an error.
#[cfg(windows)]
pub fn get(&self) -> Result<Box<PtySystem>, Error> {
pub fn get(&self) -> Fallible<Box<dyn PtySystem>> {
match self {
PtySystemSelection::ConPty => Ok(Box::new(win::conpty::ConPtySystem {})),
PtySystemSelection::WinPty => Ok(Box::new(win::winpty::WinPtySystem {})),

View File

@ -224,7 +224,7 @@ pub struct ConPtySlavePty {
}
impl MasterPty for ConPtyMasterPty {
fn resize(&self, size: PtySize) -> Result<(), Error> {
fn resize(&self, size: PtySize) -> Fallible<()> {
let mut inner = self.inner.lock().unwrap();
inner.resize(size.rows, size.cols, size.pixel_width, size.pixel_height)
}
@ -234,7 +234,7 @@ impl MasterPty for ConPtyMasterPty {
Ok(inner.size.clone())
}
fn try_clone_reader(&self) -> Result<Box<std::io::Read + Send>, Error> {
fn try_clone_reader(&self) -> Fallible<Box<dyn std::io::Read + Send>> {
Ok(Box::new(self.inner.lock().unwrap().readable.try_clone()?))
}
}
@ -249,7 +249,7 @@ impl io::Write for ConPtyMasterPty {
}
impl SlavePty for ConPtySlavePty {
fn spawn_command(&self, cmd: CommandBuilder) -> Result<Box<Child>, Error> {
fn spawn_command(&self, cmd: CommandBuilder) -> Fallible<Box<dyn Child>> {
let inner = self.inner.lock().unwrap();
let mut si: STARTUPINFOEXW = unsafe { mem::zeroed() };

View File

@ -4,7 +4,7 @@ use crate::win::winpty::safe::{
AgentFlags, MouseMode, SpawnConfig, SpawnFlags, Timeout, WinPty, WinPtyConfig,
};
use crate::{Child, MasterPty, PtyPair, PtySize, PtySystem, SlavePty};
use failure::{bail, Error, Fallible};
use failure::{bail, Fallible};
use filedescriptor::FileDescriptor;
use log::debug;
use std::ffi::OsString;
@ -32,7 +32,7 @@ pub struct WinPtySlavePty {
}
impl MasterPty for WinPtyMasterPty {
fn resize(&self, size: PtySize) -> Result<(), Error> {
fn resize(&self, size: PtySize) -> Fallible<()> {
let mut inner = self.inner.lock().unwrap();
if inner.pty.set_size(size.cols as i32, size.rows as i32)? {
inner.size = size;
@ -42,11 +42,11 @@ impl MasterPty for WinPtyMasterPty {
}
}
fn get_size(&self) -> Result<PtySize, Error> {
fn get_size(&self) -> Fallible<PtySize> {
Ok(self.inner.lock().unwrap().size)
}
fn try_clone_reader(&self) -> Result<Box<std::io::Read + Send>, Error> {
fn try_clone_reader(&self) -> Fallible<Box<dyn std::io::Read + Send>> {
Ok(Box::new(self.inner.lock().unwrap().reader.try_clone()?))
}
}
@ -61,7 +61,7 @@ impl std::io::Write for WinPtyMasterPty {
}
impl SlavePty for WinPtySlavePty {
fn spawn_command(&self, cmd: CommandBuilder) -> Result<Box<Child>, Error> {
fn spawn_command(&self, cmd: CommandBuilder) -> Fallible<Box<dyn Child>> {
let (exe, cmdline) = cmd.cmdline()?;
let cmd_os = OsString::from_wide(&cmdline);
debug!(