From 3379261e1961407be2bc2dba212d27eb738524da Mon Sep 17 00:00:00 2001 From: Steve Wooster Date: Mon, 29 Jan 2024 11:58:53 -0800 Subject: [PATCH] Add conversions to Expansion --- src/expansions.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/expansions.rs b/src/expansions.rs index 81e7316..911a706 100644 --- a/src/expansions.rs +++ b/src/expansions.rs @@ -133,6 +133,24 @@ impl Expansion { } } +impl From for Expansion { + fn from(dna: DnaSequenceStrict) -> Self { + dna.as_slice().into() + } +} + +impl From<&[Nucleotide]> for Expansion { + fn from(dna: &[Nucleotide]) -> Self { + Self(Arc::from(dna)) + } +} + +impl From> for Expansion { + fn from(dna: Arc<[Nucleotide]>) -> Self { + Self(dna) + } +} + impl From for DnaSequenceStrict { fn from(expansion: Expansion) -> Self { expansion.to_dna()