From 27a0448bfb25471872fb7feff7115f9498ad2109 Mon Sep 17 00:00:00 2001 From: Marius Isken Date: Sun, 24 Oct 2021 20:13:40 +0200 Subject: [PATCH] planer: constant reference to plan --- fftw/src/plan.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fftw/src/plan.rs b/fftw/src/plan.rs index 7cf4cd56..63952b39 100644 --- a/fftw/src/plan.rs +++ b/fftw/src/plan.rs @@ -36,6 +36,8 @@ pub struct Plan { phantom: PhantomData<(A, B)>, } +unsafe impl Sync for Plan {} +unsafe impl Sync for Plan {} unsafe impl Send for Plan {} unsafe impl Send for Plan {} @@ -97,7 +99,7 @@ pub trait C2CPlan: Sized { ) -> Result; /// Execute complex-to-complex transform - fn c2c(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()>; + fn c2c(&self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()>; } /// Trait for the plan of Real-to-Complex transformation @@ -124,7 +126,7 @@ pub trait R2CPlan: Sized { ) -> Result; /// Execute real-to-complex transform - fn r2c(&mut self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()>; + fn r2c(&self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()>; } /// Trait for the plan of Complex-to-Real transformation @@ -151,7 +153,7 @@ pub trait C2RPlan: Sized { ) -> Result; /// Execute complex-to-real transform - fn c2r(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()>; + fn c2r(&self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()>; } pub trait R2RPlan: Sized { @@ -175,7 +177,7 @@ pub trait R2RPlan: Sized { ) -> Result; /// Execute complex-to-complex transform - fn r2r(&mut self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()>; + fn r2r(&self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()>; } macro_rules! impl_c2c { @@ -204,7 +206,7 @@ macro_rules! impl_c2c { phantom: PhantomData, }) } - fn c2c(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()> { + fn c2c(&self, in_: &mut [Self::Complex], out: &mut [Self::Complex]) -> Result<()> { self.check(in_, out)?; unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) }; Ok(()) @@ -242,7 +244,7 @@ macro_rules! impl_r2c { phantom: PhantomData, }) } - fn r2c(&mut self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()> { + fn r2c(&self, in_: &mut [Self::Real], out: &mut [Self::Complex]) -> Result<()> { self.check(in_, out)?; unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) }; Ok(()) @@ -280,7 +282,7 @@ macro_rules! impl_c2r { phantom: PhantomData, }) } - fn c2r(&mut self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()> { + fn c2r(&self, in_: &mut [Self::Complex], out: &mut [Self::Real]) -> Result<()> { self.check(in_, out)?; unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) }; Ok(()) @@ -318,7 +320,7 @@ macro_rules! impl_r2r { phantom: PhantomData, }) } - fn r2r(&mut self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()> { + fn r2r(&self, in_: &mut [Self::Real], out: &mut [Self::Real]) -> Result<()> { self.check(in_, out)?; unsafe { $exec(self.plan, in_.as_mut_ptr(), out.as_mut_ptr()) }; Ok(())