mirror of https://github.com/smol-rs/vec-arena
Update documentation
This commit is contained in:
parent
36e3ba3c53
commit
f0bb71344f
32
README.md
32
README.md
|
@ -1,17 +1,29 @@
|
|||
# VecArena
|
||||
# vec-arena
|
||||
|
||||
[![Build Status](https://travis-ci.org/stjepang/vec-arena.svg?branch=master)](https://travis-ci.org/stjepang/vec-arena)
|
||||
[![License](https://img.shields.io/badge/license-Apache--2.0%2FMIT-blue.svg)](https://github.com/stjepang/vec-arena)
|
||||
<!-- [![Documentation](https://docs.rs/vec-arena/badge.svg)](https://docs.rs/vec-arena) -->
|
||||
[![Cargo](https://img.shields.io/crates/v/vec-arena.svg)](https://crates.io/crates/vec-arena)
|
||||
[![Documentation](https://docs.rs/vec-arena/badge.svg)](https://docs.rs/vec-arena)
|
||||
|
||||
<!-- [Documentation](https://docs.rs/vec-arena) -->
|
||||
#### What is this?
|
||||
|
||||
### What is this?
|
||||
A simple object arena.
|
||||
|
||||
Work in progress
|
||||
You want to build a doubly linked list? Or maybe a bidirectional tree? Perhaps an even more
|
||||
complicated object graph?
|
||||
|
||||
<!-- TODO: What is this? What problems does it solve? -->
|
||||
<!-- TODO: How to install? -->
|
||||
<!-- TODO: Where is the documentation -->
|
||||
<!-- TODO: Examples directory -->
|
||||
<!-- https://docs.rs/vec-arena -->
|
||||
Managing ownership and lifetimes might be tough then. Your options boil down to:
|
||||
|
||||
1. Use unsafe code to escape Rust's ownership rules.
|
||||
2. Wrap every object in `Rc<RefCell<T>>`.
|
||||
3. Use `Vec<T>` to store objects, then access them using indices.
|
||||
|
||||
If the last option seems most appealing to you, perhaps `Arena<T>` is for you.
|
||||
It will provide a more convenient API than a plain `Vec<T>`.
|
||||
|
||||
#### Examples
|
||||
|
||||
Some data structures built using `Arena<T>`:
|
||||
|
||||
* [Doubly linked list](https://github.com/stjepang/vec-arena/blob/master/examples/linked_list.rs)
|
||||
* [Splay tree](https://github.com/stjepang/vec-arena/blob/master/examples/splay_tree.rs)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! A fast general-purpose object arena.
|
||||
//! A simple object arena.
|
||||
//!
|
||||
//! `Arena<T>` is basically just a `Vec<Option<T>>`, which allows you to:
|
||||
//!
|
||||
|
@ -13,9 +13,6 @@
|
|||
//! * Widget hierarchies in GUIs
|
||||
//! * Graphs with circular references
|
||||
//!
|
||||
//! As a rule of thumb, if building a data structure using `Rc` and `RefCell` gets too messy or
|
||||
//! costly, `Arena` might be a better choice.
|
||||
//!
|
||||
//! # Examples
|
||||
//!
|
||||
//! * [Doubly linked list](https://github.com/stjepang/vec-arena/blob/master/examples/linked_list.rs)
|
||||
|
|
Loading…
Reference in New Issue