From cf6c1236bde071fd0c515991c9471f16045dc7bf Mon Sep 17 00:00:00 2001 From: "Brandon Saint-John (aarch64)" Date: Sat, 24 Dec 2022 23:26:07 -0800 Subject: [PATCH] impl AuxFieldSet for EnumField --- src/auxiliary.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/auxiliary.rs b/src/auxiliary.rs index 511de07..a21a657 100644 --- a/src/auxiliary.rs +++ b/src/auxiliary.rs @@ -349,6 +349,25 @@ impl AuxFieldSetExt for String { } } +impl AuxFieldSetExt for EnumField { + fn aux_set( + &self, + rec: &mut Record, + field: B, + writer: &mut FileWriter, + ) -> Result<(), Slow5Error> + where + Self: Sized, + B: Into>, + { + if self.0 > (u8::MAX as usize) { + Err(Slow5Error::TooManyLabels(self.0)) + } else { + (self.0 as u8).aux_set(rec, field, writer) + } + } +} + #[cfg(test)] mod test { use super::*;