From f2be679014965ead57e26cf9310bf20bf7ab776a Mon Sep 17 00:00:00 2001 From: YakoYakoYokuYoku <39890836+YakoYakoYokuYoku@users.noreply.github.com> Date: Sat, 9 Feb 2019 16:11:00 -0300 Subject: [PATCH 1/2] Added real part and imaginary part methods I've just added this two methods 'cause i saw this project lacked them. --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 69461fd..aaf8d2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -143,6 +143,16 @@ impl> Complex { #[cfg(feature = "std")] impl Complex { + /// Returns the real part. + #[inline] + pub fn real(&self) -> T { + self.re + } + /// Returns the imaginary part. + #[inline] + pub fn imag(&self) -> T { + self.re + } /// Calculate |self| #[inline] pub fn norm(&self) -> T { From df88912a1d3cb9292fe4e388b87f13f0cca769de Mon Sep 17 00:00:00 2001 From: YakoYakoYokuYoku <39890836+YakoYakoYokuYoku@users.noreply.github.com> Date: Sat, 9 Feb 2019 17:10:59 -0300 Subject: [PATCH 2/2] Update lib.rs --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index aaf8d2e..84aae02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -151,7 +151,7 @@ impl Complex { /// Returns the imaginary part. #[inline] pub fn imag(&self) -> T { - self.re + self.im } /// Calculate |self| #[inline]