[][src]Trait futures_intrusive::buffer::RealArray

pub unsafe trait RealArray<T> {
    const LEN: usize;
}

A marker trait which may only be implemented for native array types, like [T; 2]. The library incorporates several components that are parameterized by array types, but currently Rust provides no safe mechanism to express that.

In order to work around the limitations, these methods only accept arrays which implement the RealArray type. The library provides an implementation of RealArray for arrays up to length 64, as well as for all powers of 2 up to 64k.

In order to let the library accept arrays of bigger sizes, RealArray can be implemented by users via newtypes. A type as defined in the following example can be passed to the library:

use futures_intrusive::buffer::RealArray;
use futures_intrusive::channel::LocalChannel;

struct I32x384Array([i32; 384]);
unsafe impl RealArray<i32> for I32x384Array {
    const LEN: usize = 384;
}

impl AsMut<[i32]> for I32x384Array {
    fn as_mut(&mut self) -> &mut [i32] {
        &mut self.0
    }
}

impl AsRef<[i32]> for I32x384Array {
    fn as_ref(&self) -> &[i32] {
        &self.0
    }
}

fn main() {
    let channel = LocalChannel::<i32, I32x384Array>::new();
}

Associated Constants

const LEN: usize

The length of the array

Loading content...

Implementations on Foreign Types

impl<T> RealArray<T> for [T; 0][src]

impl<T> RealArray<T> for [T; 1][src]

impl<T> RealArray<T> for [T; 2][src]

impl<T> RealArray<T> for [T; 3][src]

impl<T> RealArray<T> for [T; 4][src]

impl<T> RealArray<T> for [T; 5][src]

impl<T> RealArray<T> for [T; 6][src]

impl<T> RealArray<T> for [T; 7][src]

impl<T> RealArray<T> for [T; 8][src]

impl<T> RealArray<T> for [T; 9][src]

impl<T> RealArray<T> for [T; 10][src]

impl<T> RealArray<T> for [T; 11][src]

impl<T> RealArray<T> for [T; 12][src]

impl<T> RealArray<T> for [T; 13][src]

impl<T> RealArray<T> for [T; 14][src]

impl<T> RealArray<T> for [T; 15][src]

impl<T> RealArray<T> for [T; 16][src]

impl<T> RealArray<T> for [T; 17][src]

impl<T> RealArray<T> for [T; 18][src]

impl<T> RealArray<T> for [T; 19][src]

impl<T> RealArray<T> for [T; 20][src]

impl<T> RealArray<T> for [T; 21][src]

impl<T> RealArray<T> for [T; 22][src]

impl<T> RealArray<T> for [T; 23][src]

impl<T> RealArray<T> for [T; 24][src]

impl<T> RealArray<T> for [T; 25][src]

impl<T> RealArray<T> for [T; 26][src]

impl<T> RealArray<T> for [T; 27][src]

impl<T> RealArray<T> for [T; 28][src]

impl<T> RealArray<T> for [T; 29][src]

impl<T> RealArray<T> for [T; 30][src]

impl<T> RealArray<T> for [T; 31][src]

impl<T> RealArray<T> for [T; 32][src]

impl<T> RealArray<T> for [T; 33][src]

impl<T> RealArray<T> for [T; 34][src]

impl<T> RealArray<T> for [T; 35][src]

impl<T> RealArray<T> for [T; 36][src]

impl<T> RealArray<T> for [T; 37][src]

impl<T> RealArray<T> for [T; 38][src]

impl<T> RealArray<T> for [T; 39][src]

impl<T> RealArray<T> for [T; 40][src]

impl<T> RealArray<T> for [T; 41][src]

impl<T> RealArray<T> for [T; 42][src]

impl<T> RealArray<T> for [T; 43][src]

impl<T> RealArray<T> for [T; 44][src]

impl<T> RealArray<T> for [T; 45][src]

impl<T> RealArray<T> for [T; 46][src]

impl<T> RealArray<T> for [T; 47][src]

impl<T> RealArray<T> for [T; 48][src]

impl<T> RealArray<T> for [T; 49][src]

impl<T> RealArray<T> for [T; 50][src]

impl<T> RealArray<T> for [T; 51][src]

impl<T> RealArray<T> for [T; 52][src]

impl<T> RealArray<T> for [T; 53][src]

impl<T> RealArray<T> for [T; 54][src]

impl<T> RealArray<T> for [T; 55][src]

impl<T> RealArray<T> for [T; 56][src]

impl<T> RealArray<T> for [T; 57][src]

impl<T> RealArray<T> for [T; 58][src]

impl<T> RealArray<T> for [T; 59][src]

impl<T> RealArray<T> for [T; 60][src]

impl<T> RealArray<T> for [T; 61][src]

impl<T> RealArray<T> for [T; 62][src]

impl<T> RealArray<T> for [T; 63][src]

impl<T> RealArray<T> for [T; 64][src]

impl<T> RealArray<T> for [T; 128][src]

impl<T> RealArray<T> for [T; 256][src]

impl<T> RealArray<T> for [T; 512][src]

impl<T> RealArray<T> for [T; 1024][src]

impl<T> RealArray<T> for [T; 2048][src]

impl<T> RealArray<T> for [T; 4096][src]

impl<T> RealArray<T> for [T; 8192][src]

impl<T> RealArray<T> for [T; 16384][src]

impl<T> RealArray<T> for [T; 32768][src]

impl<T> RealArray<T> for [T; 65536][src]

Loading content...

Implementors

Loading content...