Skip to content

Commit c53fa64

Browse files
committed
app: Add documentation
1 parent cf91dcb commit c53fa64

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/app.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,25 @@ use curl::http;
1212

1313
use {db, Config};
1414

15+
/// The `App` struct holds the main components of the application like
16+
/// the database connection pool and configurations
1517
pub struct App {
18+
/// The database connection pool
1619
pub database: db::Pool,
20+
21+
/// The GitHub OAuth2 configuration
1722
pub github: oauth2::Config,
1823
pub bucket: s3::Bucket,
1924
pub s3_proxy: Option<String>,
2025
pub session_key: String,
2126
pub git_repo: Mutex<git2::Repository>,
2227
pub git_repo_checkout: PathBuf,
28+
29+
/// The server configuration
2330
pub config: Config,
2431
}
2532

33+
/// The `AppMiddleware` injects an `App` instance into the `Request` extensions
2634
pub struct AppMiddleware {
2735
app: Arc<App>
2836
}
@@ -82,6 +90,7 @@ impl Middleware for AppMiddleware {
8290
}
8391
}
8492

93+
/// Adds an `app()` method to the `Request` type returning the global `App` instance
8594
pub trait RequestApp {
8695
fn app(&self) -> &Arc<App>;
8796
}

0 commit comments

Comments
 (0)