Skip to main content

Ctchi

Struct Ctchi 

Source
pub struct Ctchi { /* private fields */ }

Implementations§

Source§

impl Ctchi

Source

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
Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.