Skip to content

Commit

Permalink
Add Default implementation for CommandRegistry and update examples
Browse files Browse the repository at this point in the history
Implement Default trait for CommandRegistry to simplify instantiation, making it easier to create a default instance.
  • Loading branch information
Christian Stolz committed Oct 21, 2024
1 parent 01e0c51 commit 2cd520f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions crates/rbchat/src/chat/command_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ pub struct CommandRegistry {
commands: HashMap<String, CommandInformation>,
}

impl Default for CommandRegistry {
fn default() -> Self {
Self::new()
}
}

impl CommandRegistry {
pub fn new() -> Self {
CommandRegistry {
Expand Down
2 changes: 1 addition & 1 deletion crates/rbchat/src/config/config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//!
//! Here’s an example of how you can utilize this module:
//!
//! ```rust
//! ```no_run
//! // Get the current application configuration
//! use rbchat::config::CONFIG;
//! let config = CONFIG.lock().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/rbchat/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//!
//! Here’s an example of how you can utilize this module:
//!
//! ```rust
//! ```no_run
//! // Get the current application configuration
//! use rbchat::config::CONFIG;
//! let config = CONFIG.lock().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/rbchat/src/persona/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//!
//! You can list all available personas and see how they can assist you in your session with Rusty Buddy:
//!
//! ```rust
//! ```no_run
//! use rbchat::persona::{print_all_personas, get_persona};
//!
//! // Print all available personas
Expand Down

0 comments on commit 2cd520f

Please sign in to comment.