# rblist [![Crates.io](https://img.shields.io/crates/v/rblist.svg)](https://crates.io/crates/rblist) [![Docs.rs](https://docs.rs/rblist/badge.svg)](https://docs.rs/rblist) A block-based, non-circular double-linked list implementation for Rust. ## Overview `rblist` is a block-based, non-circular double-linked list that allows for efficient manipulation of data. It supports standard operations such as inserting, removing, and iterating over elements. The crate is optimized for use cases where you need a high-performance list structure for quick inserting and deletion, but with some flexibility in managing nodes and data directly. ### Features - Block-based architecture for better memory efficiency. - Support for inserting and removing elements by node reference. - Iterator support for traversing elements. - Simple and clean API for list manipulation. - Not multi-thread safe by design (can be protected with a mutex). ## Example Here is a basic example of how to use `rblist`: ```rust use rblist::{BList, Scale}; let mut list: BList = BList::new(Scale::default()); let node1 = list.push_back(1).unwrap(); let node3 = list.push_back(3).unwrap(); let node2 = list.insert_before(2, &node3).unwrap(); for x in list.iter() { println!("{}", *x.value().unwrap()); } assert_eq!(list.len(), 3); assert_eq!(*list.value(&node1).unwrap(), 1); let v = list.remove(&node2).unwrap(); assert_eq!(v, 2); assert_eq!(list.len(), 2); let v = list.pop_front(); assert_eq!(v.unwrap(), 1); assert_eq!(list.len(), 1); assert_eq!(*list.front().unwrap(), 3); ``` ## License Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ## Installation To use rblist in your project, add the following to your Cargo.toml: ```toml [dependencies] rblist = "0.1.x"