aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd/record.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/record.rs')
-rw-r--r--src/cmd/record.rs70
1 files changed, 31 insertions, 39 deletions
diff --git a/src/cmd/record.rs b/src/cmd/record.rs
index f2e0aab..6a31c5d 100644
--- a/src/cmd/record.rs
+++ b/src/cmd/record.rs
@@ -113,7 +113,7 @@ impl RecordSession {
&'static [&'static dyn for<'a> Fn(
&'a mut Self,
)
- -> crate::component_future::Poll<
+ -> component_future::Poll<
(),
Error,
>] = &[
@@ -124,36 +124,36 @@ impl RecordSession {
&Self::poll_write_file,
];
- fn poll_open_file(&mut self) -> crate::component_future::Poll<(), Error> {
+ fn poll_open_file(&mut self) -> component_future::Poll<(), Error> {
match &mut self.file {
FileState::Closed { filename } => {
self.file = FileState::Opening {
filename: filename.to_string(),
fut: tokio::fs::File::create(filename.to_string()),
};
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
FileState::Opening { filename, fut } => {
- let file = try_ready!(fut.poll().with_context(|| {
- crate::error::OpenFile {
- filename: filename.clone(),
- }
- }));
+ let file = component_future::try_ready!(fut
+ .poll()
+ .with_context(|| {
+ crate::error::OpenFile {
+ filename: filename.clone(),
+ }
+ }));
let mut file = crate::ttyrec::File::new(file);
file.write_frame(self.buffer.contents())?;
self.file = FileState::Open { file };
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
FileState::Open { .. } => {
- Ok(crate::component_future::Async::NothingToDo)
+ Ok(component_future::Async::NothingToDo)
}
}
}
- fn poll_read_process(
- &mut self,
- ) -> crate::component_future::Poll<(), Error> {
- match try_ready!(self.process.poll()) {
+ fn poll_read_process(&mut self) -> component_future::Poll<(), Error> {
+ match component_future::try_ready!(self.process.poll()) {
Some(crate::resize::Event::Process(e)) => {
match e {
crate::process::Event::CommandStart(..) => {
@@ -174,10 +174,10 @@ impl RecordSession {
}
}
}
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
Some(crate::resize::Event::Resize(_)) => {
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
None => {
if !self.done {
@@ -185,62 +185,54 @@ impl RecordSession {
}
// don't return final event here - wait until we are done
// writing all data to the file (see poll_write_file)
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
}
}
- fn poll_write_terminal(
- &mut self,
- ) -> crate::component_future::Poll<(), Error> {
+ fn poll_write_terminal(&mut self) -> component_future::Poll<(), Error> {
if self.sent_local == self.buffer.len() {
- return Ok(crate::component_future::Async::NothingToDo);
+ return Ok(component_future::Async::NothingToDo);
}
- let n = try_ready!(self
+ let n = component_future::try_ready!(self
.stdout
.poll_write(&self.buffer.contents()[self.sent_local..])
.context(crate::error::WriteTerminal));
self.sent_local += n;
self.needs_flush = true;
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
- fn poll_flush_terminal(
- &mut self,
- ) -> crate::component_future::Poll<(), Error> {
+ fn poll_flush_terminal(&mut self) -> component_future::Poll<(), Error> {
if !self.needs_flush {
- return Ok(crate::component_future::Async::NothingToDo);
+ return Ok(component_future::Async::NothingToDo);
}
- try_ready!(self
+ component_future::try_ready!(self
.stdout
.poll_flush()
.context(crate::error::FlushTerminal));
self.needs_flush = false;
- Ok(crate::component_future::Async::DidWork)
+ Ok(component_future::Async::DidWork)
}
- fn poll_write_file(
- &mut self,
- ) -> crate::component_future::Poll<(), Error> {
+ fn poll_write_file(&mut self) -> component_future::Poll<(), Error> {
let file = match &mut self.file {
FileState::Open { file } => file,
_ => {
- return Ok(crate::component_future::Async::NothingToDo);
+ return Ok(component_future::Async::NothingToDo);
}
};
match file.poll_write()? {
- futures::Async::Ready(()) => {
- Ok(crate::component_future::Async::DidWork)
- }
+ futures::Async::Ready(()) => Ok(component_future::Async::DidWork),
futures::Async::NotReady => {
// ship all data to the server before actually ending
if self.done && file.is_empty() {
- Ok(crate::component_future::Async::Ready(()))
+ Ok(component_future::Async::Ready(()))
} else {
- Ok(crate::component_future::Async::NotReady)
+ Ok(component_future::Async::NotReady)
}
}
}
@@ -253,6 +245,6 @@ impl futures::future::Future for RecordSession {
type Error = Error;
fn poll(&mut self) -> futures::Poll<Self::Item, Self::Error> {
- crate::component_future::poll_future(self, Self::POLL_FNS)
+ component_future::poll_future(self, Self::POLL_FNS)
}
}