[][src]Struct milstian_internet_framework::Application

pub struct Application { /* fields omitted */ }

Main entry point for a new application.

Could in the future support multiple transport layers and application layers.

TCP HTTP static application:

use milstian_internet_framework::{Application, Config};
let config = Config::from_env().expect("Failed to get configuration from environment");
Application::new(config).tcp_http_with_legacy_responders();

Methods

impl Application[src]

pub fn new(config: Config) -> Application[src]

pub fn get_config(&self) -> &Config[src]

pub fn get_feedback(&self) -> &Feedback[src]

pub fn tcp_http(&self, responders: Vec<Box<dyn ResponderInterface + Send>>)[src]

Create a new TCP HTTP application

Example

extern crate milstian_internet_framework;
use milstian_internet_framework::{Application, Config};
use milstian_internet_framework::response::tcp::http::{error, file_not_found, filesystem, ResponderInterface};
fn main() {
    let responders: Vec<Box<ResponderInterface + Send>> = vec![
        Box::new(filesystem::Responder::new()),
        Box::new(error::Responder::new()),
    ];
    let config = Config::from_env().expect("Failed to get configuration from environment");
    Application::new(config).tcp_http(responders);
}

pub fn tcp_http_with_legacy_responders(&self)[src]

Create a new TCP HTTP application with the legacy responders

Example

extern crate milstian_internet_framework;
use milstian_internet_framework::{Application, Config};
fn main() {
    let config = Config::from_env().expect("Failed to get configuration from environment");
    Application::new(config).tcp_http_with_legacy_responders();
}

pub fn tcp_http_with_legacy_and_custom_responders(
    &self,
    custom: Box<dyn ResponderInterface + Send>
)
[src]

Create a new TCP with legacy and a custom responder

use milstian_internet_framework::{Application, Config};
fn main() {
    let config = Config::from_env().expect("Failed to get configuration from environment");
    Application::new(config).tcp_http_with_legacy_responders();
}

Trait Implementations

impl Clone for Application[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Application[src]

Auto Trait Implementations

impl Send for Application

impl Sync for Application

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.