1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
use crate::prelude::*; #[ cfg (feature = "hss-main") ] #[ cfg (feature = "hss-handler") ] #[ cfg (feature = "hss-server-http") ] pub fn main_with_handler (_handler : impl Handler, _configuration : Option<Configuration>) -> ServerResult { let mut _configuration = main_configuration_from_template (_configuration) ?; _configuration.handler = Some (HandlerDynArc::new (_handler)); Server::run_and_wait (_configuration) } #[ cfg (feature = "hss-main") ] #[ cfg (feature = "hss-handler") ] #[ cfg (feature = "hss-server-http") ] pub fn main_with_handler_dyn (_handler : impl HandlerDyn, _configuration : Option<Configuration>) -> ServerResult { let mut _configuration = main_configuration_from_template (_configuration) ?; _configuration.handler = Some (HandlerDynArc::new (_handler)); Server::run_and_wait (_configuration) } #[ cfg (feature = "hss-main") ] #[ cfg (feature = "hss-routes") ] #[ cfg (feature = "hss-server-http") ] pub fn main_with_routes (_routes : impl Into<Routes>, _configuration : Option<Configuration>) -> ServerResult { let mut _configuration = main_configuration_from_template (_configuration) ?; _configuration.handler = Some (HandlerDynArc::new (_routes.into ())); Server::run_and_wait (_configuration) } #[ cfg (feature = "hss-main") ] #[ cfg (feature = "hss-server-http") ] pub fn main_configuration_http () -> ServerResult<Configuration> { let _configuration = Configuration::localhost_http () .build () ?; main_configuration_from_template (Some (_configuration)) } #[ cfg (feature = "hss-main") ] #[ cfg (feature = "hss-server-http") ] #[ cfg (feature = "hss-tls-andy") ] pub fn main_configuration_https () -> ServerResult<Configuration> { let _configuration = Configuration::localhost_https () .build () ?; main_configuration_from_template (Some (_configuration)) } #[ cfg (feature = "hss-main") ] #[ cfg (feature = "hss-server-http") ] pub fn main_configuration_from_template (_configuration : Option<Configuration>) -> ServerResult<Configuration> { let mut _configuration = if let Some (_configuration) = _configuration { _configuration } else { Configuration::localhost_http () .build () ? }; #[ cfg (feature = "hss-cli") ] ConfigurationArguments::parse_and_update (&mut _configuration) ?; Ok (_configuration) }