# [−][src]Trait nalgebra::base::allocator::Allocator

    pub trait Allocator<N: Scalar, R: Dim, C: Dim = U1>: Any + Sized {
        type Buffer: ContiguousStorageMut<N, R, C> + Clone;
        unsafe fn allocate_uninitialized(nrows: R, ncols: C) -> Self::Buffer;
        fn allocate_from_iterator<I: IntoIterator<Item = N>>(
            nrows: R,
            ncols: C,
            iter: I
        ) -> Self::Buffer;
    }

A matrix allocator of a memory buffer that may contain `R::to_usize() * C::to_usize()` elements of type `N`.

An allocator is said to be: − static: if `R` and `C` both implement `DimName`. − dynamic: if either one (or both) of `R` or `C` is equal to `Dynamic`.

Every allocator must be both static and dynamic. Though not all implementations may share the same `Buffer` type.

## Associated Types

### `type Buffer: ContiguousStorageMut<N, R, C> + Clone`

The type of buffer this allocator can instanciate.

Loading content...

## Required methods

### `unsafe fn allocate_uninitialized(nrows: R, ncols: C) -> Self::Buffer`

Allocates a buffer with the given number of rows and columns without initializing its content.

### `fn allocate_from_iterator<I: IntoIterator<Item = N>>(
nrows: R,
ncols: C,
iter: I
) -> Self::Buffer`

Allocates a buffer initialized with the content of the given iterator.

Loading content...

## Implementors

### `impl<N, R, C> Allocator<N, R, C> for DefaultAllocator where
N: Scalar,
R: DimName,
C: DimName,
R::Value: Mul<C::Value>,
Prod<R::Value, C::Value>: ArrayLength<N>,` [src]

#### `type Buffer = ArrayStorage<N, R, C>`

#### `unsafe fn allocate_uninitialized(_: R, _: C) -> Self::Buffer`[src]

#### `fn allocate_from_iterator<I: IntoIterator<Item = N>>(
nrows: R,
ncols: C,
iter: I
) -> Self::Buffer`[src]

### `impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator`[src]

#### `type Buffer = VecStorage<N, Dynamic, C>`

#### `unsafe fn allocate_uninitialized(nrows: Dynamic, ncols: C) -> Self::Buffer`[src]

#### `fn allocate_from_iterator<I: IntoIterator<Item = N>>(
nrows: Dynamic,
ncols: C,
iter: I
) -> Self::Buffer`[src]

### `impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator`[src]

#### `type Buffer = VecStorage<N, R, Dynamic>`

#### `unsafe fn allocate_uninitialized(nrows: R, ncols: Dynamic) -> Self::Buffer`[src]

#### `fn allocate_from_iterator<I: IntoIterator<Item = N>>(
nrows: R,
ncols: Dynamic,
iter: I
) -> Self::Buffer`[src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)