Selaa lähdekoodia

:memo: some more documentation for Complex

Felix Bytow 2 vuotta sitten
vanhempi
sitoutus
633546c595
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      src/types/complex.rs

+ 4 - 0
src/types/complex.rs

@@ -28,7 +28,9 @@ use crate::{Float, Numeric, Primitive};
 /// ```
 #[derive(Debug, Copy, Clone)]
 pub struct Complex<T: Float + Numeric + Primitive> {
+    /// The real component of the complex number.
     pub real: T,
+    /// The imaginary component of the complex number.
     pub imag: T,
 }
 
@@ -72,6 +74,7 @@ impl<T: Float + Numeric + Primitive> Default for Complex<T> {
 }
 
 impl<T: Float + Numeric + Primitive> Complex<T> {
+    /// Create a complex number with its imaginary component being zero.
     pub fn real(value: T) -> Self {
         Self {
             real: value,
@@ -79,6 +82,7 @@ impl<T: Float + Numeric + Primitive> Complex<T> {
         }
     }
 
+    /// Create a complex number with its real component being zero.
     pub fn imag(value: T) -> Self {
         Self {
             real: unsafe { T::whole(0) },