dog-core
This template provides a foundation for creating a Rust library crate with a well-structured lib.rs file and testing infrastructure.
Features
- Library crate structure with documentation
- Unit tests setup
- Benchmarking with Criterion
- Error handling with anyhow
- Ready for publishing to crates.io
Getting Started
After generating your project with FerrisUp, follow these steps:
-
Navigate to your project directory:
-
Run the tests:
-
Run benchmarks:
-
Build the documentation:
Project Structure
src/lib.rs: Main library file with documentation and testsCargo.toml: Project configuration with development dependencies
Customization
Adding Modules
As your library grows, consider organizing it into modules:
// In src/lib.rs
// Create src/utils.rs or src/utils/mod.rs
// Create src/models.rs or src/models/mod.rs
Documentation
The template includes doc comments. Expand them to document your API:
/// Performs an important calculation.
///
/// # Examples
///
/// ```
/// let result = dog-core::calculate(42);
/// assert_eq!(result, 84);
/// ```
///
/// # Errors
///
/// Returns an error if the input is invalid.
Publishing
Prepare your library for publishing:
-
Update
Cargo.tomlwith metadata:[] = "dog-core" = "0.1.0" = ["Your Name <your.email@example.com>"] = "2021" = "A brief description of your library" = "https://github.com/yourusername/dog-core" = "MIT OR Apache-2.0" = ["keyword1", "keyword2"] = ["category1", "category2"] -
Publish to crates.io:
Next Steps
- Add your library's core functionality to
src/lib.rs - Create additional modules as needed
- Write comprehensive tests and examples
- Set up CI/CD with GitHub Actions
- Add a README.md with usage examples