GitXplorerGitXplorer
N

vechonk

public
5 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
5c7e834599a72d0467af85200f4fc547860a387a

rust toolchain

NNoratrieb committed 2 years ago
Unverified
3e67985bcff1ca31e0f561a99aa11a27bd3506c8

fmt

NNoratrieb committed 2 years ago
Unverified
5ec62ae0cf27fa4d0737f025ebf74efe89550399

fixes

NNoratrieb committed 2 years ago
Unverified
e479d5a1c5fba7314253f62954d1e2efe6c5c91d

better rust toolchain

NNoratrieb committed 2 years ago
Unverified
1d4ca0bcda60ccbcb53d6d9a2d24a6b3367d1b28

portable tests

NNoratrieb committed 2 years ago
Unverified
c71158bcf57bd3b85c9b17ba3f60d6122372a6c3

strict provenance, lol

NNoratrieb committed 2 years ago

README

The README file for this repository.

A Vec<T: ?Sized>

It's implemented by laying out the elements in memory contiguously like alloc::vec::Vec

Layout

A Vechonk is 4 usize long. It owns a single allocation, containing the elements and the metadata. The elements are laid out contiguously from the front, while the metadata is laid out contiguously from the back. Both grow towards the center until they meet and get realloced to separate them again.

            Vechonk<str>
            ╭──────────────────────────────────╮
            │ ptr   | len   | cap  | elem_size │
            ╰──────────────────────────────────╯
               │               │        │
               │               ╰────────│──────────────────────────────────────╮
               │                        │                                      │
               │               ╭────────╯                                      │
        Heap   ▼               ▼                                               ▼
        ╭────────────┬─────────┬─────────────────┬──────────────┬──────────────╮
value   │ "hello"    │ "uwu"   │  <uninit>       │ 0 - 5        │ 5 - 3        │
        ├────────────┼─────────┼─────────────────┼──────────────┼──────────────┤
 size   │ dynamic    │ dynamic │  rest of alloc  │ usize + meta │ usize + meta │
        ╰────────────┴─────────┴─────────────────┴──────────────┴──────────────╯
            ▲            ▲                          │              │
            ╰────────────│──────────────────────────╯              │
                         ╰─────────────────────────────────────────╯