renew-traits
renew-traits provides a set of utility traits to manage, initialize, and extend collections or other data structures in a consistent and reusable way. The crate is designed to help you define flexible and extensible APIs for managing internal collections and structures.
Traits
1. ExtendWith
Extends a collection with a single item, handling potential errors.
2. FillToLenWithItems
Fills a collection with a list of items until it reaches a specified length.
3. ReinitWithLen
Reinitializes a collection or structure to a specified length.
4. FillWith
Fills a collection with a single value across all its elements.
5. InitInternals
Initializes internal data structures, returning a result to handle potential errors.
6. InitWithSize
Initializes the internal structure with a given size.
7. Clear
Clears all elements from the collection or structure.
8. CreateNamedEmpty
Creates an empty instance with an associated name.
9. CreateEmpty
Creates an empty instance of a collection or structure.
10. ResetWith
Resets the collection or structure using a provided input.
Installation
Add renew-traits to your Cargo.toml:
[]
= "0.1"
Usage
Here's an example of how to implement some of the traits:
License
This crate is licensed under either of:
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Contributing
Contributions are welcome! Feel free to submit a pull request or open an issue on GitHub.