Procházet zdrojové kódy

:memo: some more documentation for Complex

Felix Bytow před 2 roky
rodič
revize
633546c595
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  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) },