You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
10 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `Complex` trait in crate `complex`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, Complex">
  9. <title>complex::Complex - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../main.css">
  11. </head>
  12. <body class="rustdoc">
  13. <!--[if lte IE 8]>
  14. <div class="warning">
  15. This old browser is unsupported and will most likely display funky
  16. things.
  17. </div>
  18. <![endif]-->
  19. <section class="sidebar">
  20. <p class='location'><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'Complex', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script>
  21. </section>
  22. <nav class="sub">
  23. <form class="search-form js-only">
  24. <div class="search-container">
  25. <input class="search-input" name="search"
  26. autocomplete="off"
  27. placeholder="Click or press 'S' to search, '?' for more options..."
  28. type="search">
  29. </div>
  30. </form>
  31. </nav>
  32. <section id='main' class="content trait">
  33. <h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>complex</a>::<wbr><a class='trait' href=''>Complex</a></span><span class='out-of-band'><span id='render-detail'>
  34. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  35. [<span class='inner'>&#x2212;</span>]
  36. </a>
  37. </span><a id='src-34' class='srclink' href='../src/complex/lib.rs.html#22-61' title='goto source code'>[src]</a></span></h1>
  38. <pre class='rust trait'>pub trait Complex: <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> {
  39. type Real: <a class='trait' href='../complex/trait.Real.html' title='complex::Real'>Real</a>;
  40. fn <a href='#tymethod.new' class='fnname'>new</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -&gt; Self;
  41. fn <a href='#tymethod.from_polar' class='fnname'>from_polar</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -&gt; Self;
  42. fn <a href='#tymethod.re' class='fnname'>re</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>;
  43. fn <a href='#tymethod.re_mut' class='fnname'>re_mut</a>(&amp;mut self) -&gt; &amp;mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>;
  44. fn <a href='#tymethod.im' class='fnname'>im</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>;
  45. fn <a href='#tymethod.im_mut' class='fnname'>im_mut</a>(&amp;mut self) -&gt; &amp;mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>;
  46. fn <a href='#tymethod.abs' class='fnname'>abs</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>;
  47. fn <a href='#tymethod.arg' class='fnname'>arg</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>;
  48. fn <a href='#method.to_polar' class='fnname'>to_polar</a>(&amp;self) -&gt; <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>)</a> { ... }
  49. fn <a href='#method.conj' class='fnname'>conj</a>(&amp;self) -&gt; Self { ... }
  50. }</pre><div class='docblock'><p>A complex number.</p>
  51. </div>
  52. <h2 id='associated-types'>Associated Types</h2>
  53. <div class='methods'>
  54. <h3 id='associatedtype.Real' class='method stab '><code>type Real: <a class='trait' href='../complex/trait.Real.html' title='complex::Real'>Real</a></code></h3><div class='docblock'><p>A real number.</p>
  55. </div></div>
  56. <h2 id='required-methods'>Required Methods</h2>
  57. <div class='methods'>
  58. <h3 id='tymethod.new' class='method stab '><code>fn <a href='#tymethod.new' class='fnname'>new</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -&gt; Self</code></h3><div class='docblock'><p>Create a complex number from a real and an imaginary part.</p>
  59. </div><h3 id='tymethod.from_polar' class='method stab '><code>fn <a href='#tymethod.from_polar' class='fnname'>from_polar</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -&gt; Self</code></h3><div class='docblock'><p>Create a complex number from a modulus and an argument.</p>
  60. </div><h3 id='tymethod.re' class='method stab '><code>fn <a href='#tymethod.re' class='fnname'>re</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the real part.</p>
  61. </div><h3 id='tymethod.re_mut' class='method stab '><code>fn <a href='#tymethod.re_mut' class='fnname'>re_mut</a>(&amp;mut self) -&gt; &amp;mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the real part as a mutable reference.</p>
  62. </div><h3 id='tymethod.im' class='method stab '><code>fn <a href='#tymethod.im' class='fnname'>im</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the imaginary part.</p>
  63. </div><h3 id='tymethod.im_mut' class='method stab '><code>fn <a href='#tymethod.im_mut' class='fnname'>im_mut</a>(&amp;mut self) -&gt; &amp;mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the imaginary part as a mutable reference.</p>
  64. </div><h3 id='tymethod.abs' class='method stab '><code>fn <a href='#tymethod.abs' class='fnname'>abs</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Compute the modulus.</p>
  65. </div><h3 id='tymethod.arg' class='method stab '><code>fn <a href='#tymethod.arg' class='fnname'>arg</a>(&amp;self) -&gt; Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Compute the argument.</p>
  66. </div></div>
  67. <h2 id='provided-methods'>Provided Methods</h2>
  68. <div class='methods'>
  69. <h3 id='method.to_polar' class='method stab '><code>fn <a href='#method.to_polar' class='fnname'>to_polar</a>(&amp;self) -&gt; <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>)</a></code></h3><div class='docblock'><p>Compute the modulus and the argument.</p>
  70. </div><h3 id='method.conj' class='method stab '><code>fn <a href='#method.conj' class='fnname'>conj</a>(&amp;self) -&gt; Self</code></h3><div class='docblock'><p>Compute the complex conjugate.</p>
  71. </div></div>
  72. <h2 id='implementors'>Implementors</h2>
  73. <ul class='item-list' id='implementors-list'>
  74. <li><code>impl <a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Complex</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></li>
  75. <li><code>impl <a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Complex</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></li>
  76. </ul><script type="text/javascript" async
  77. src="../implementors/complex/trait.Complex.js">
  78. </script></section>
  79. <section id='search' class="content hidden"></section>
  80. <section class="footer"></section>
  81. <div id="help" class="hidden">
  82. <div class="shortcuts">
  83. <h1>Keyboard shortcuts</h1>
  84. <dl>
  85. <dt>?</dt>
  86. <dd>Show this help dialog</dd>
  87. <dt>S</dt>
  88. <dd>Focus the search field</dd>
  89. <dt>&larrb;</dt>
  90. <dd>Move up in search results</dd>
  91. <dt>&rarrb;</dt>
  92. <dd>Move down in search results</dd>
  93. <dt>&#9166;</dt>
  94. <dd>Go to active search result</dd>
  95. </dl>
  96. </div>
  97. <div class="infos">
  98. <h1>Search tricks</h1>
  99. <p>
  100. Prefix searches with a type followed by a colon (e.g.
  101. <code>fn:</code>) to restrict the search to a given type.
  102. </p>
  103. <p>
  104. Accepted types are: <code>fn</code>, <code>mod</code>,
  105. <code>struct</code>, <code>enum</code>,
  106. <code>trait</code>, <code>typedef</code> (or
  107. <code>tdef</code>).
  108. </p>
  109. <p>
  110. Search functions by type signature (e.g.
  111. <code>vec -> usize</code>)
  112. </p>
  113. </div>
  114. </div>
  115. <script>
  116. window.rootPath = "../";
  117. window.currentCrate = "complex";
  118. window.playgroundUrl = "";
  119. </script>
  120. <script src="../jquery.js"></script>
  121. <script src="../main.js"></script>
  122. <script async src="../search-index.js"></script>
  123. </body>
  124. </html>