Crates.io | treena |
lib.rs | treena |
version | 0.0.5 |
source | src |
created_at | 2021-09-26 16:10:57.02582 |
updated_at | 2022-03-14 21:24:15.609879 |
description | Tree stored in an arena |
homepage | |
repository | https://gitlab.com/nop_thread/treena |
max_upload_size | |
id | 456590 |
size | 265,561 |
Treena: Trees stored in an arena.
Treena is heavily inspired by indextree crate, but has extra goals.
A.insert_before(B)
mean?
"insert A before B" or "insert B before A"?P.insert_before(A, B)
can be interpreted relatively naturally:
"P (parent) inserts the node A before the node B".
However, P
here is completely redundant since it must be the
parent of A
.A.adopt(B, AsFoo)
and
forest.insert(A, AsFooOf(B))
. They are much clearer than the traditional
names.
A.adopt(B, AdoptAs::LastChild)
can be read as
"the node A adopts the node B as the last child of A".forest.insert(A, InsertAs::NextSiblingOf(B))
can
be read as "insert the node A as the next sibling of the node B"..expect()
everywhere with meaningful message when it won't fail
or should panic for some reason.
[precondition] node must be alive
,
you can be aware immediately that the passed node is not alive but it
violates precondition of the function.[consistency] foobarbaz
,
it is sure that this is a bug of treena (not you).Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.