deepbiop_fa/encode/
record.rs1use bstr::BString;
2use derive_builder::Builder;
3
4#[derive(Debug, Default, Builder)]
5pub struct RecordData {
6 pub id: BString,
7 pub seq: BString,
8}
9
10impl RecordData {
11 pub fn new(id: BString, seq: BString) -> Self {
12 Self { id, seq }
13 }
14}
15
16impl From<(Vec<u8>, Vec<u8>)> for RecordData {
17 fn from(data: (Vec<u8>, Vec<u8>)) -> Self {
18 Self::new(data.0.into(), data.1.into())
19 }
20}
21
22impl From<(BString, BString)> for RecordData {
23 fn from(data: (BString, BString)) -> Self {
24 Self::new(data.0, data.1)
25 }
26}
27
28#[cfg(test)]
29mod tests {
30 use super::*;
31
32 #[test]
33 fn test_record_data_build() {
34 let record = RecordDataBuilder::default()
35 .id("id".into())
36 .seq("seq".into())
37 .build()
38 .unwrap();
39
40 assert_eq!(record.id, "id");
41 assert_eq!(record.seq, "seq");
42 }
43}