#once-cell #list #value #linked-list #multiple-values #unsized #nightly

once-list2

A single linked list which is backed by OnceCell. You can append the value to the non-mutable OnceList.

4 releases (2 breaking)

0.3.1 Jan 2, 2025
0.3.0 Dec 30, 2024
0.2.0 Dec 27, 2024
0.1.0 Dec 4, 2024

#1539 in Data structures

Download history 118/week @ 2024-12-04 11/week @ 2024-12-11 251/week @ 2024-12-25 155/week @ 2025-01-01 9/week @ 2025-01-08

415 downloads per month

Custom license

35KB
589 lines

Crates.io Version docs.rs

This library is a natural extension of the std::cell::OnceCell (or its original crate once_cell) library. This library provides a single-linked list OnceList type that allows you to store multiple values in a single OnceList instance even without the need for the mutability.

Alternatives (Consider using these crates first!)

  • once_cell - The original crate that provides a OnceCell type. If you only need to store a single value, this crate is quite enough.
  • elsa - A crate that provides Frozen collection types that allows you to store multiple values without the need for the mutability. They provides something similar to Vec or HashMap, so if your use case requires more than 3-ish values or you need more complex data structure than a single-linked list, then you should use this crate instead.

Features

By default, none of the features are enabled.

  • nightly: Enables the nightly-only features.

    • Uses the allocator_api std unstable feature. Note that even without this feature, this crate still supports the allocators thanks to the allocator_api2 crate.
    • Supports the special methods for the unsized value types. See the doc of OnceList for more details.
  • sync: This library internally uses std::cell::OnceCell which is not thread-safe. When you enable this feature, this library uses the thread-safe ]std::sync::OnceLock instead.

Dependencies

~265KB