# icentral-node-stack
`icentral-node-stack` is a Rust crate that provides efficient, stack-based data management functionality with traits and implementations tailored for handling `NodeId` structures. It offers a robust interface to maintain and manipulate collections of node identifiers, facilitating operations essential for traversal, modification, and analysis in data structure management.
## Features
- **Node Access and Mutation**: Use `NodeAtIndex` and `SetNodeAtIndex` traits to access and modify nodes at specific indices.
- **Stack Operations**: Built-in support for `push` and `pop`, streamlining operations typical of stack data structures through the `Push` and `Pop` traits.
- **Debug and Clear Capabilities**: Implementations of `CreateNamedEmpty` and `Clear` further enhance the management of node stacks.
- **Custom Macros**: The `delegate_to_bfs_stack!` macro provides extensive capabilities for integrating breadth-first search strategies directly within stack operations.
## Getting Started
To utilize the `icentral-node-stack` crate, add the following to your `Cargo.toml`:
```toml
[dependencies]
icentral-node-stack = "0.1.0"
```
## Usage Example
```rust
use icentral_node_stack::{NodeIdStack, NodeId, Push, Pop};
fn main() {
let first_node = NodeId::new(); // Assume NodeId::new() creates a new NodeId
let mut stack = NodeIdStack::new(first_node, "example");
// Push a new node
stack.push(NodeId::new());
// Access a node at index
let node = stack.node_at_index(0);
// Modify a node at a specific index
stack.set_node_at_index(0, NodeId::new());
// Pop a node
if let Some(popped_node) = stack.pop() {
println!("Popped node: {:?}", popped_node);
}
}
```
## Documentation
For further information and more intricate usage patterns, please refer to the [documentation](https://docs.rs/icentral-node-stack). This documentation includes additional examples and feature explanations to assist you in effectively utilizing this crate.
---
*This README.md file was generated by an AI model. While it strives for accuracy, some details may not fully reflect the latest state of the crate. However, it should provide a solid starting point and overview.*
This crate is in the process of being translated from c++ to rust. Currently, it still needs exhaustive testing. It is likely there currently exist many glitches which need to be fixed before proper usage. This crate is based on the original icentral program developed by Fuad Jamor. Please see the following repository for details: https://github.com/fjamour/icentral.
For progress updates, see the workspacer rust project.