#garbage-collection #thread-safe #data #data-structures #manual #language

ndata

Thread-safe, self-owned JSON-like data with manual garbage collection

43 releases

0.3.10 Jan 24, 2024
0.3.7 Dec 5, 2023
0.3.6 Sep 15, 2023
0.3.5 Mar 12, 2023
0.1.5 Jul 13, 2022

#112 in Memory management

Download history 4/week @ 2024-01-17 38/week @ 2024-01-24 7/week @ 2024-01-31 45/week @ 2024-02-07 285/week @ 2024-02-14 14/week @ 2024-02-21 18/week @ 2024-02-28 10/week @ 2024-03-13 7/week @ 2024-03-20 54/week @ 2024-03-27 72/week @ 2024-04-03

143 downloads per month
Used in flowlang

MIT license

70KB
1.5K SLoC

NData

NData provides self-owned data structures supporting objects, arrays, strings, integers, floats, booleans, byte buffers, and null. DataObject, DataArray, and DataBytes instances maintain reference counts. Garbage collection is performed manually by calling the NData::gc() function.

Rapid Prototyping

Rust's memory management and type safety can add significant up-front development effort when compared to languages with built-in garbage collection and relaxed type safety. NData restores those benefits, making Rust the perfect language for rapid prototyping. Yes, this does re-introduce the performance penalties and potential bugs, but unlike those other languages you can easily refactor them out of your code once you've worked out the logic.

Example: Doubly Linked List

Multithreaded Environments

NData is thread-safe by design. Objects can easily be shared between threads without worrying about ownership or mutexes, etc.

Example: Multi-threaded

Global Variables

Global variables are discouraged, and with good reason. However, sometimes you need them anyway-- and you shouldn't have to dork around with unsafe code, pointers, boxes, cells, and whatnot just to throw some data on the heap.

Example: Globals

Panic Management

Self-owned structures are not lost when panics occur. They are a convenient way to recover key information when unwinding a panic.

Example: Panic

Garbage Collection

NData adds Toaster-Simple™ garbage collection to Rust.

Example: Garbage Collection

Hotswap Live Code

NData works well in conjunction with the hot-lib-reloader crate, allowing you to swap new code into your running app as you write it while maintaining the state of your runtime variables.

Example: Hot-Reload

Dependencies

~0–265KB