Skip to content

Commit

Permalink
Use alloc_wg repo for collections
Browse files Browse the repository at this point in the history
  • Loading branch information
95th authored and Singh, Gurwinder committed Dec 4, 2019
1 parent 1ade235 commit 574a981
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 6,532 deletions.
156 changes: 76 additions & 80 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ name = "benches"
path = "benches/benches.rs"
harness = false

[dependencies]
alloc-wg = { git = "https://github.com/TimDiekmann/alloc-wg" }

[dev-dependencies]
quickcheck = "0.8.2"
criterion = "0.3.0"

[features]
default = ["collections"]
collections = []
default = []

# This feature is only included for backwards compatibility and
# no longer has any effect
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![](https://docs.rs/bumpalo/badge.svg)](https://docs.rs/bumpalo/)
[![](https://img.shields.io/crates/v/bumpalo.svg)](https://crates.io/crates/bumpalo)
[![](https://img.shields.io/crates/d/bumpalo.svg)](https://crates.io/crates/bumpalo)
[![Build Status](https://dev.azure.com/fitzgen/bumpalo/_apis/build/status/fitzgen.bumpalo?branchName=master)](https://dev.azure.com/fitzgen/bumpalo/_build/latest?definitionId=2&branchName=master)
[![Build Status](https://dev.azure.com/95x/bumpalo/_apis/build/status/95th.bumpalo?branchName=master)](https://dev.azure.com/95x/bumpalo/_build/latest?definitionId=7&branchName=master)

![](https://github.com/fitzgen/bumpalo/raw/master/bumpalo.png)

Expand Down Expand Up @@ -65,13 +65,13 @@ assert!(scooter.scritches_required);

### Collections

When the on-by-default `"collections"` feature is enabled, a fork of some of the
`std` library's collections are available in the `collections` module. These
collection types are modified to allocate their space inside `bumpalo::Bump`
arenas.
You can use a fork of some of the `std` library's collections that are available
in the `alloc-wg` crate. These collection type are generic over the choice of allocator
to allocate their space inside.

```rust
use bumpalo::{Bump, collections::Vec};
use bumpalo::Bump;
use alloc_wg::vec::Vec;

// Create a new bump arena.
let bump = Bump::new();
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ jobs:
- job: tests
displayName: "Tests"
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-18.04'
steps:
- template: ci/install-rust.yml
parameters:
rust_version: stable
rust_version: nightly
- template: ci/install-cargo-readme.yml
- bash: |
set -ex
Expand All @@ -29,7 +29,7 @@ jobs:
steps:
- template: ci/install-rust.yml
parameters:
rust_version: stable
rust_version: nightly
- bash: |
set -ex
cargo check --benches
Expand Down
4 changes: 2 additions & 2 deletions benches/benches.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc_wg::format;
use criterion::*;

#[derive(Default)]
Expand All @@ -24,10 +25,9 @@ fn alloc_with<T: Default>(n: usize) {
}
}

#[cfg(feature = "collections")]
fn format_realloc(bump: &bumpalo::Bump, n: usize) {
let n = criterion::black_box(n);
let s = bumpalo::format!(in bump, "Hello {:.*}", n, "World! ");
let s = format!(in bump, "Hello {:.*}", n, "World! ");
criterion::black_box(s);
}

Expand Down
4 changes: 3 additions & 1 deletion ci/install-rust.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
steps:
- script: |
set -e
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain none
rustup toolchain install $RUSTUP_TOOLCHAIN
rustup default $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
env:
RUSTUP_TOOLCHAIN: ${{parameters.rust_version}}
Expand Down
Loading

0 comments on commit 574a981

Please # to comment.