aboutsummaryrefslogtreecommitdiffstats
path: root/src/creator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/creator.rs')
-rw-r--r--src/creator.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/creator.rs b/src/creator.rs
index fb228dd..c0f9b76 100644
--- a/src/creator.rs
+++ b/src/creator.rs
@@ -1,17 +1,34 @@
+/// Creates ttyrec frames.
+///
+/// A ttyrec file is a stream of concatenated frames. This struct creates
+/// `Frame` objects, which can be serialized to bytes using their `try_from`
+/// implementation, and then a ttyrec file can be generated by concatenating
+/// those byte strings.
#[derive(Debug, Clone)]
pub struct Creator {
base_time: Option<std::time::Instant>,
}
impl Creator {
+ /// Creates a new `Creator` instance.
pub fn new() -> Self {
Default::default()
}
+ /// Returns a new `Frame` object containing the given data.
+ ///
+ /// Equivalent to calling `frame_at` and passing
+ /// `std::time::Instant::now()` as the `cur_time` parameter.
pub fn frame(&mut self, data: &[u8]) -> crate::frame::Frame {
self.frame_at(std::time::Instant::now(), data)
}
+ /// Returns a new `Frame` object containing the given data at the given
+ /// time.
+ ///
+ /// Note that this is not guaranteed to do the correct thing unless the
+ /// `cur_time` parameters given in each `frame_at` call are
+ /// non-decreasing.
pub fn frame_at(
&mut self,
cur_time: std::time::Instant,