pub struct Ctchi { /* private fields */ }Implementations§
Source§impl Ctchi
impl Ctchi
Sourcepub fn new(routes: Routes) -> Ctchi
pub fn new(routes: Routes) -> Ctchi
Create new application with specified routes.
Configuration gets by ctchi::core::ctchi::get_configuration() singleton.
§Arguments:
routes- list of routes.ctchi::core::ctchi::Routes
Sourcepub fn start(self) -> Result<()>
pub fn start(self) -> Result<()>
Start configured application. Now it will lister for specified ip:port and respond for request if URI is in routes
§Examples:
ⓘ
#![feature(concat_idents)]
#[macro_use]
extern crate ctchi;
use ctchi::core::app::Ctchi;
use ctchi::core::routes::{Routes, Route};
use ctchi_codegen::route;
#[route("/")]
fn index() -> String {
render!("index.html")
}
fn main() {
let mut routes = Routes::new();
// add route to your controller
routes.add_route(routes!(index)());
// create and run local server
let server = Ctchi::new(routes);
let server_result = match server.start() {
Ok(()) => "Ctchi application server is successfully running!".to_string(),
Err(err) => format!("Can't start server! Because '{}'", err)
};
}Auto Trait Implementations§
impl Freeze for Ctchi
impl RefUnwindSafe for Ctchi
impl Send for Ctchi
impl Sync for Ctchi
impl Unpin for Ctchi
impl UnsafeUnpin for Ctchi
impl UnwindSafe for Ctchi
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