Skip to content

Commit

Permalink
Add serde feature
Browse files Browse the repository at this point in the history
Fixes: #4
  • Loading branch information
WalterSmuts committed Feb 7, 2024
1 parent 3bb9884 commit c7971ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ default = ["fallible"]
[dependencies]
array-init = "2.1.0"
generic_singleton = "0.4.1"
num-complex = { version = "0.4.5", features = ["serde"] }
realfft = { version = "3.0.1"}
rustfft = "6.0.1"
serde = { version = "1.0.193", features = ["derive"] , optional = true}

[dev-dependencies]
approx = "0.5.1"
7 changes: 7 additions & 0 deletions src/dyn_size/realfft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ use realfft::ComplexToReal;
use realfft::RealToComplex;
use rustfft::num_complex::Complex;
use rustfft::FftNum;

#[cfg(feature = "serde")]
use serde::Deserialize;
#[cfg(feature = "serde")]
use serde::Serialize;

use std::collections::HashMap;
use std::fmt::Debug;
#[cfg(feature = "fallible")]
Expand Down Expand Up @@ -173,6 +179,7 @@ impl<T: FftNum + Default, U: ?Sized + RealToComplex<T>> StaticScratchRealToCompl
/// [known to be symmetric]: https://en.wikipedia.org/wiki/Discrete_Fourier_transform#DFT_of_real_and_purely_imaginary_signals
/// [phantom type]: https://doc.rust-lang.org/rust-by-example/generics/phantom.html
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct DynRealDft<T> {
original_length: usize,
inner: Box<[Complex<T>]>,
Expand Down

0 comments on commit c7971ae

Please sign in to comment.