-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(shared): remove name from
module
(#137)
* chore: remove name from `module` * fix broken tests
- Loading branch information
1 parent
b5c9068
commit 1f00c03
Showing
2 changed files
with
17 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
use crate::traits::NgynController; | ||
use std::sync::Arc; | ||
|
||
/// `NgynModule` is a trait that defines the basic structure of a module in Ngyn. | ||
/// Modules are the building blocks of an application in Ngyn. | ||
/// They are used to group related [controllers](https://ngyn.rs/docs/foundations/controllers). | ||
/// | ||
/// ### Example | ||
/// | ||
/// ```rust | ||
/// use ngyn_shared::traits::NgynModule; | ||
/// | ||
/// pub struct AppModule; | ||
/// | ||
/// impl NgynModule for AppModule { | ||
/// fn new() -> Self { | ||
/// Self {} | ||
/// } | ||
/// } | ||
/// ``` | ||
pub trait NgynModule: Send + Sync { | ||
/// Creates a new instance of the module. | ||
fn new() -> Self | ||
where | ||
Self: Sized; | ||
|
||
/// Returns the name of the module. | ||
fn name(&self) -> &str; | ||
|
||
/// Returns the controllers of the module. | ||
fn get_controllers(&self) -> Vec<Arc<Box<dyn NgynController + 'static>>> { | ||
vec![] | ||
Vec::new() | ||
} | ||
} |