aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-03 19:43:06 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-03 19:43:06 -0500
commit8a98d4fee2172d5ac53e74bcc95cd39aa68492a3 (patch)
tree10fb97bbd275fc1ea6a1e69300e7ba1bc1e35430 /src/parser.rs
parent22b2262bdc097ac6ddbe4c7ce488b1afb4f9127e (diff)
downloadttyrec-8a98d4fee2172d5ac53e74bcc95cd39aa68492a3.tar.gz
ttyrec-8a98d4fee2172d5ac53e74bcc95cd39aa68492a3.zip
remove async stuff, clean up everything else
will reintroduce the async stuff in a future commit
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 45b900e..126eae3 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -34,6 +34,7 @@ pub struct Parser {
impl Parser {
/// Create a new `Parser`.
+ #[must_use]
pub fn new() -> Self {
Self::default()
}
@@ -48,6 +49,7 @@ impl Parser {
/// If a complete frame is found, the bytes for that frame will be removed
/// from the internal buffer and the frame object will be returned. If a
/// complete frame is not found, this method will return `None`.
+ #[allow(clippy::missing_panics_doc)]
pub fn next_frame(&mut self) -> Option<crate::frame::Frame> {
let header = if let Some(header) = &self.read_state {
header
@@ -56,6 +58,7 @@ impl Parser {
return None;
}
+ // these unwraps are guaranteed safe by the length check above
let secs1 = self.reading.pop_front().unwrap();
let secs2 = self.reading.pop_front().unwrap();
let secs3 = self.reading.pop_front().unwrap();
@@ -106,6 +109,7 @@ impl Parser {
/// each frame timestamp after that should be offset by that same amount.
///
/// Returns `None` if no frames have been read yet.
+ #[must_use]
pub fn offset(&self) -> Option<std::time::Duration> {
self.offset
}