1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2021-2024 Jeff Knaggs
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
use crateCodec;
use crateSeqSlice;
//use crate::seq::Seq;
use crate::;
//use bitvec::field::BitField;
//use core::fmt;
use PhantomData;
use Deref;
use ptr;
//use core::ops::{BitAnd, BitOr};
//use std::hash::{Hash, Hasher};
/// Static bit-packed sequence meant to be accessed as a `&'static SeqSlice`
///
/// ```
/// # use bio_seq::prelude::*;
/// // internally, `dna!` constructs a `SeqArray<Dna>`
/// let seq: &'static SeqSlice<Dna> = dna!("ACGTGT");
/// ```
/*
impl<A: Codec, const K: usize, const W: usize> Hash for SeqArray<A, K, W> {
fn hash<H: Hasher>(&self, state: &mut H) {
let bs: &SeqSlice<A> = self.as_ref();
bs.hash(state);
}
}
*/
/*
impl<A: Codec, const N: usize> From<&SeqArray<A, N, 1>> for usize {
fn from(slice: &SeqArray<A, N, 1>) -> usize {
slice.bs.load_le::<usize>()
}
}
impl<A: Codec, const N: usize, const W: usize> fmt::Display for SeqArray<A, N, W> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self.as_ref(), f)
}
}
impl<A: Codec, const N: usize, const W: usize> BitAnd for &SeqArray<A, N, W> {
type Output = Seq<A>;
fn bitand(self, rhs: Self) -> Self::Output {
let mut bv = self.ba.to_bitvec();
bv &= &rhs.ba;
bv.truncate(N * A::BITS as usize);
Seq::<A> {
bv,
_p: PhantomData,
}
}
}
impl<A: Codec, const N: usize, const W: usize> BitOr for &SeqArray<A, N, W> {
type Output = Seq<A>;
fn bitor(self, rhs: Self) -> Self::Output {
let mut bv = self.ba.to_bitvec();
bv |= &rhs.ba;
bv.truncate(N * A::BITS as usize);
Seq::<A> {
bv,
_p: PhantomData,
}
}
}
*/