pub struct CmlServer { /* private fields */ }Expand description
ipaddre ip和端口的映射
http_app_top ├ 路径路由方法 ├ 上传方式方式 ├ 传输信息 ├ 成员数量
ipaddnum ip地址的个数 http_setbpost 增加
pool_num 线程个数
top_templ dow_templ 变量头尾
overtext 结束关键字
Implementations§
Source§impl<'a> CmlServer
impl<'a> CmlServer
Sourcepub fn new(ipadd: &'static str, pnum: usize) -> CmlServer
pub fn new(ipadd: &'static str, pnum: usize) -> CmlServer
声明一个 web、websocket以及tcp服务。
§Examples
绑定一个ip和端口“0.0.0.0:8000“ 到当前服务,并且开启10个工作线程。
let mut cml = CmlServer::new(“0.0.0.0:8000”,10);
设置ip以及post pnum 设置多个线程数
Sourcepub fn templ(&'a mut self, top_template: String, down_template: String)
pub fn templ(&'a mut self, top_template: String, down_template: String)
templ 中的string是为了在模板中识别变量替换文本用的关键字
例如 模板中的变量为 {$pname}
将用 templ(“{$”.to_string(),“}”.to_string()); 来处理这变量个分割数据方法
Sourcepub fn http_route(
&'a mut self,
pathdata: &'static str,
html_fun: fn(r: PortR, h: Hshell) -> String,
port: &'static str,
)
pub fn http_route( &'a mut self, pathdata: &'static str, html_fun: fn(r: PortR, h: Hshell) -> String, port: &'static str, )
http server 设置目录和内容地址
§Examples
CmlServer.http_route( “/sleep?user&name”, sleep,“get|post”);
设置目录地址。
主要是三个问题 一个是方法 二是地址
Sourcepub fn http_setbpost(&'a mut self, inpost: &'static str)
pub fn http_setbpost(&'a mut self, inpost: &'static str)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CmlServer
impl RefUnwindSafe for CmlServer
impl Send for CmlServer
impl Sync for CmlServer
impl Unpin for CmlServer
impl UnwindSafe for CmlServer
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