[][src]Trait vecshard::ShardExt

pub trait ShardExt {
    type Shard;
    fn split_inplace_at(self, at: usize) -> (Self::Shard, Self::Shard);
}

An extension trait for things that can be split into shards

For your convenience, this is implemented for both Vec and VecShard, so you can split recursively:

let drinks = vec!["heineken", "jupiler", "turmbräu", "orange juice", "champagne"];

let (beers, other_drinks) = drinks.split_inplace_at(3);
let (bad_beers, good_beers) = beers.split_inplace_at(2);

assert_eq!(*good_beers, ["turmbräu"]);

Associated Types

type Shard

Loading content...

Required methods

fn split_inplace_at(self, at: usize) -> (Self::Shard, Self::Shard)

Split this array into two shards at the given index. This is an O(1) operation, as it keeps the underlying storage. In exchange, this means that the memory will not be reclaimed until all existing shards using it are dropped.

Loading content...

Implementations on Foreign Types

impl<T> ShardExt for Vec<T>[src]

type Shard = VecShard<T>

Loading content...

Implementors

impl<T> ShardExt for VecShard<T>[src]

type Shard = VecShard<T>

Loading content...