Crates.io | ndata |
lib.rs | ndata |
version | 0.3.11 |
source | src |
created_at | 2022-05-01 17:58:40.053307 |
updated_at | 2024-12-01 01:56:23.024084 |
description | Thread-safe, self-owned JSON-like data with manual garbage collection. |
homepage | https://github.com/mraiser/ndata |
repository | https://github.com/mraiser/ndata |
max_upload_size | |
id | 578695 |
size | 69,625 |
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.
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
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 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
Self-owned structures are not lost when panics occur. They are a convenient way to recover key information when unwinding a panic.
Example: Panic
NData adds Toaster-Simpleā¢ garbage collection to Rust.
Example: Garbage Collection
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