CmlServer

Struct CmlServer 

Source
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

Source

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 设置多个线程数

Source

pub fn templ(&'a mut self, top_template: String, down_template: String)

templ 中的string是为了在模板中识别变量替换文本用的关键字

例如 模板中的变量为 {$pname}

将用 templ(“{$”.to_string(),“}”.to_string()); 来处理这变量个分割数据方法

Source

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”);

设置目录地址。

主要是三个问题 一个是方法 二是地址

Source

pub fn over_text(&'a mut self, text: &str)

优雅的结束服务

§Examples

cml.over_text(“over”);

shell $ over 当shell中输入 over 后程序结束进程并关闭 结束进程关闭程序。

Source

pub fn http_setbpost(&'a mut self, inpost: &'static str)

添加备用ip和端口

§Examples

cml.http_setbpost(“0.0.0.0:8001”); 设置备用的ip和post。

Source

pub fn biud(&'a self)

执行程序

§Examples

cml.biud(); 执行监听和执行。

Trait Implementations§

Source§

impl Clone for CmlServer

Source§

fn clone(&self) -> CmlServer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CmlServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.