gecko-dev/third_party/rust/owning_ref
Manish Goregaokar cd6c97ea60 Bug 1336607 - Update vendored Rust sources to include geckolib dependencies; r=froydnj
MozReview-Commit-ID: BOgu41N351y

--HG--
rename : third_party/rust/serde/.cargo-checksum.json => third_party/rust/serde-0.8.23/.cargo-checksum.json
rename : third_party/rust/serde/Cargo.toml => third_party/rust/serde-0.8.23/Cargo.toml
rename : third_party/rust/serde/src/bytes.rs => third_party/rust/serde-0.8.23/src/bytes.rs
rename : third_party/rust/serde/src/de/impls.rs => third_party/rust/serde-0.8.23/src/de/impls.rs
rename : third_party/rust/serde/src/de/mod.rs => third_party/rust/serde-0.8.23/src/de/mod.rs
rename : third_party/rust/serde/src/de/value.rs => third_party/rust/serde-0.8.23/src/de/value.rs
rename : third_party/rust/serde/src/error.rs => third_party/rust/serde-0.8.23/src/error.rs
rename : third_party/rust/serde/src/lib.rs => third_party/rust/serde-0.8.23/src/lib.rs
rename : third_party/rust/serde/src/macros.rs => third_party/rust/serde-0.8.23/src/macros.rs
rename : third_party/rust/serde/src/ser/impls.rs => third_party/rust/serde-0.8.23/src/ser/impls.rs
rename : third_party/rust/serde/src/ser/mod.rs => third_party/rust/serde-0.8.23/src/ser/mod.rs
extra : rebase_source : d015147c7a6c01b34c5a1abf035d71f8ecfe0c12
2017-02-10 12:19:18 -08:00
..
src
.cargo-checksum.json
.cargo-ok
.gitignore
.travis.yml
Cargo.toml
LICENSE
README.md

README.md

owning-ref-rs

Travis-CI Status

A library for creating references that carry their owner with them.

For more details, see the docs.

Getting Started

owning-ref-rs is available on crates.io. Add the following dependency to your Cargo manifest to get the latest version of the 0.2 branch:

[dependencies]
owning_ref = "0.2"

To always get the latest version, add this git repository to your Cargo manifest:

[dependencies.owning_ref]
git = "https://github.com/Kimundi/owning-ref-rs"

Example

extern crate owning_ref;
use owning_ref::BoxRef;

fn main() {
    // Create an array owned by a Box.
    let arr = Box::new([1, 2, 3, 4]) as Box<[i32]>;

    // Transfer into a BoxRef.
    let arr: BoxRef<[i32]> = BoxRef::new(arr);
    assert_eq!(&*arr, &[1, 2, 3, 4]);

    // We can slice the array without losing ownership or changing type.
    let arr: BoxRef<[i32]> = arr.map(|arr| &arr[1..3]);
    assert_eq!(&*arr, &[2, 3]);

    // Also works for Arc, Rc, String and Vec!
}