Skip to content

Commit 3fa1820

Browse files
authored
feat: strand: Use serde (#38)
Implement Serialize and Deserialize for Strand, ReqStrand, and NoStrand.
1 parent 5e550cc commit 3fa1820

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/strand.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66
//! Data types for strand information on annotations.
77
8+
#[cfg(feature = "serde")]
9+
use serde::{Deserialize, Serialize};
810
use std::fmt::{self, Display, Formatter};
911
use std::ops::Neg;
1012
use std::str::FromStr;
1113
use thiserror::Error;
1214

1315
/// Strand information.
1416
#[derive(Debug, Clone, Copy)]
17+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1518
pub enum Strand {
1619
Forward,
1720
Reverse,
@@ -134,6 +137,7 @@ impl From<NoStrand> for Strand {
134137

135138
/// Strand information for annotations that require a strand.
136139
#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd, Copy)]
140+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
137141
pub enum ReqStrand {
138142
Forward,
139143
Reverse,
@@ -243,6 +247,7 @@ impl Neg for ReqStrand {
243247
/// Strand information for annotations that definitively have no
244248
/// strand information.
245249
#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd, Copy)]
250+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
246251
pub enum NoStrand {
247252
Unknown,
248253
}

0 commit comments

Comments
 (0)