pub struct CoolApp {
pub config: CoolConfig,
pub db: Option<DatabaseConnection>,
pub modules: ModuleRegistry,
pub events: EventManager,
}Expand description
应用构建器
Fields§
§config: CoolConfig配置
db: Option<DatabaseConnection>数据库连接
modules: ModuleRegistry模块注册表
events: EventManager事件管理器
Implementations§
Source§impl CoolApp
impl CoolApp
Sourcepub fn new(config: CoolConfig) -> Self
pub fn new(config: CoolConfig) -> Self
创建新的应用
Sourcepub fn database(self, db: DatabaseConnection) -> Self
pub fn database(self, db: DatabaseConnection) -> Self
设置数据库连接
Sourcepub fn build_router(&self, prefix: &str) -> Router
pub fn build_router(&self, prefix: &str) -> Router
构建路由
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CoolApp
impl !RefUnwindSafe for CoolApp
impl !UnwindSafe for CoolApp
impl Send for CoolApp
impl Sync for CoolApp
impl Unpin for CoolApp
impl UnsafeUnpin for CoolApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more