Documentation
wscml-0.1.9 has been yanked.

wscml

介绍

rust编写web server服务 web server cml。因为还是测试版本,每发布一个版本前一个版本就将关闭使用。直到完成测试版本,正式版将由1.0版本以后。 rust: web server web server cml。Because or the test version, each release a version will be closed using the previous version. Until he finished test version, after the official version by version 1.0.

软件架构

软件架构说明 Software architecture description

官方网站

http://www.qhd.in

QQ群:300021630

安装教程

[dependencies]

wscml = "0.1.9"

升级内容

增加一个有呀的关闭服务器方法。 在声明服务时增加 over_text("esc") 函数在函数的第一个值中投递一个str变量值。他将在shell中以这个次作为关闭服务的关键字。 The way to increase a have shut down the server. When a statement service increase over_text (" esc ") function in the function of the first value in delivering a STR variable values. He will be in the shell at this time as a closed service keyword.

使用说明

use wscml::{CmlServer,PortR,Hshell,pr_time};

fn main(){
    let mut cml = CmlServer::new("0.0.0.0:8080",1000);
    cml.http_setbpost("0.0.0.0:8000");
    cml.templ("{$".to_string(),"}".to_string()); //模板的替换模板
    cml.over_text("over"); //关闭服务的关键字
    cml.http_route( "/", index,"");
    cml.http_route( "/sleep?user&name", sleep,"get|post");
    cml.http_route( "/sleeps?id&code", sleeps,"get");
    cml.http_route( "/post?id&mm", post,"get");
    cml.biud();
    
}

fn index (r: PortR, h:Hshell) -> String {
    println!("    index:{:?}",r);
    format!("")
}

fn sleeps (r: PortR, h:Hshell) -> String {

    let sc = r.getg_n("user");
    let name: String = r.getg_n("name");
    let zt: String = r.getreqtop("state");
    let zts: String = r.getreqtop("methods");
    let body: String = format!(
        "
            <head>
            <title>{}</title>
            <meta name=\"keywords\" content=\"{}\">
            <meta name=\"subject-time\" content={:?}>
            <meta name=\"description\" content=\"\">
            <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1, viewport-fit=cover\">
            <meta name=\"format-detection\" content=\"telephone=no\">
            </head>
        ",
        "陈孟蕾 - 个人中心 - 华陈数据",
        "华陈数据开发者社区,云计算社区,云+社区,开发者技术分享社区,www.qhd.in",
        pr_time("%Y-%m-%d %H:%M:%S"),
    );

    let a: String = format!(
        "<html>{}<body><p>按钮</p>user:{} </br> name:{} </br> 状态:{} </br> 方法:{}</body></html>",
        body,
        sc,
        name,
        zt,
        zts
    );
    a
}

fn sleep (r: PortR,mut h:Hshell) -> String {
    println!("{:?}",r);

    let tem: String = h
        .add("name","野原新之助")
        .add("pname","sss")
        .template("h/yyxzz.html");
    tem
}

fn post (r: PortR, h:Hshell) -> String {
    format!("post")
}

参与贡献

  1. 陈孟蕾