pub struct Application { /* private fields */ }
Expand description
§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();
Implementations§
Source§impl Application
impl Application
Sourcepub fn new(config: Config) -> Application
pub fn new(config: Config) -> Application
Examples found in repository?
More examples
pub fn get_config(&self) -> &Config
pub fn get_feedback(&self) -> &Feedback
Sourcepub fn tcp_http(&self, responders: Vec<Box<dyn ResponderInterface + Send>>)
pub fn tcp_http(&self, responders: Vec<Box<dyn ResponderInterface + Send>>)
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);
}
Sourcepub fn tcp_http_with_legacy_responders(&self)
pub fn tcp_http_with_legacy_responders(&self)
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();
}
Sourcepub fn tcp_http_with_legacy_and_custom_responders(
&self,
custom: Box<dyn ResponderInterface + Send>,
)
pub fn tcp_http_with_legacy_and_custom_responders( &self, custom: Box<dyn ResponderInterface + Send>, )
Trait Implementations§
Source§impl Clone for Application
impl Clone for Application
Source§fn clone(&self) -> Application
fn clone(&self) -> Application
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Application
impl RefUnwindSafe for Application
impl Send for Application
impl Sync for Application
impl Unpin for Application
impl UnwindSafe for Application
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