forked from pola-rs/polars
/
type.Array.html
43 lines (40 loc) · 8.22 KB
/
type.Array.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An array that owns its data uniquely."><meta name="keywords" content="rust, rustlang, rust-lang, Array"><title>ndarray::Array - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc type"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../ndarray/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Type Definition Array</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.into_raw_vec">into_raw_vec</a><a href="#method.into_scalar">into_scalar</a></div></div><p class="location"><a href="index.html">ndarray</a></p><div id="sidebar-vars" data-name="Array" data-ty="type" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Type Definition <a href="index.html">ndarray</a>::<wbr><a class="type" href="">Array</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../src/ndarray/lib.rs.html#1290" title="goto source code">[src]</a></span></h1><pre class="rust typedef">type Array<A, D> = <a class="struct" href="../ndarray/struct.ArrayBase.html" title="struct ndarray::ArrayBase">ArrayBase</a><<a class="struct" href="../ndarray/struct.OwnedRepr.html" title="struct ndarray::OwnedRepr">OwnedRepr</a><A>, D>;</pre><div class="docblock"><p>An array that owns its data uniquely.</p>
<p><code>Array</code> is the main n-dimensional array type, and it owns all its array
elements.</p>
<p>The <code>Array<A, D></code> is parameterized by <code>A</code> for the element type and <code>D</code> for
the dimensionality.</p>
<p><a href="struct.ArrayBase.html"><strong><code>ArrayBase</code></strong></a> is used to implement both the owned
arrays and the views; see its docs for an overview of all array features.</p>
<p>See also:</p>
<ul>
<li><a href="struct.ArrayBase.html#constructor-methods-for-owned-arrays">Constructor Methods for Owned Arrays</a></li>
<li><a href="struct.ArrayBase.html#methods-for-all-array-types">Methods For All Array Types</a></li>
<li>Dimensionality-specific type alises
<a href="type.Array1.html"><code>Array1</code></a>,
<a href="type.Array2.html"><code>Array2</code></a>,
<a href="type.Array3.html"><code>Array3</code></a>, …,
<a href="type.ArrayD.html"><code>ArrayD</code></a>,
and so on.</li>
</ul>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl<A> <a class="type" href="../ndarray/type.Array.html" title="type ndarray::Array">Array</a><A, <a class="type" href="../ndarray/type.Ix0.html" title="type ndarray::Ix0">Ix0</a>></code><a href="#impl" class="anchor"></a><a class="srclink" href="../src/ndarray/impl_owned_array.rs.html#9-41" title="goto source code">[src]</a></h3><div class="docblock"><p>Methods specific to <code>Array0</code>.</p>
<p><em><strong>See also all methods for <a href="struct.ArrayBase.html"><code>ArrayBase</code></a></strong></em></p>
</div><div class="impl-items"><h4 id="method.into_scalar" class="method"><code>pub fn <a href="#method.into_scalar" class="fnname">into_scalar</a>(self) -> A</code><a class="srclink" href="../src/ndarray/impl_owned_array.rs.html#23-40" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the single element in the array without cloning it.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">ndarray</span>::{<span class="ident">arr0</span>, <span class="ident">Array0</span>};
<span class="comment">// `Foo` doesn't implement `Clone`.</span>
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Eq</span>, <span class="ident">PartialEq</span>)]</span>
<span class="kw">struct</span> <span class="ident">Foo</span>;
<span class="kw">let</span> <span class="ident">array</span>: <span class="ident">Array0</span><span class="op"><</span><span class="ident">Foo</span><span class="op">></span> <span class="op">=</span> <span class="ident">arr0</span>(<span class="ident">Foo</span>);
<span class="kw">let</span> <span class="ident">scalar</span>: <span class="ident">Foo</span> <span class="op">=</span> <span class="ident">array</span>.<span class="ident">into_scalar</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">scalar</span>, <span class="ident">Foo</span>);</pre></div>
</div></div><h3 id="impl-1" class="impl"><code class="in-band">impl<A, D> <a class="type" href="../ndarray/type.Array.html" title="type ndarray::Array">Array</a><A, D> <span class="where fmt-newline">where<br> D: <a class="trait" href="../ndarray/trait.Dimension.html" title="trait ndarray::Dimension">Dimension</a>, </span></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../src/ndarray/impl_owned_array.rs.html#48-60" title="goto source code">[src]</a></h3><div class="docblock"><p>Methods specific to <code>Array</code>.</p>
<p><em><strong>See also all methods for <a href="struct.ArrayBase.html"><code>ArrayBase</code></a></strong></em></p>
</div><div class="impl-items"><h4 id="method.into_raw_vec" class="method"><code>pub fn <a href="#method.into_raw_vec" class="fnname">into_raw_vec</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><A></code><a class="srclink" href="../src/ndarray/impl_owned_array.rs.html#57-59" title="goto source code">[src]</a></h4><div class="docblock"><p>Return a vector of the elements in the array, in the way they are
stored internally.</p>
<p>If the array is in standard memory layout, the logical element order
of the array (<code>.iter()</code> order) and of the returned vector will be the same.</p>
</div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="ndarray" data-search-js="../search-index.js"></div>
<script src="../main.js"></script></body></html>