Skip to content

Commit 2e63102

Browse files
committed
[rust/vidi] viz has been renamed to vidi
1 parent 80c46e9 commit 2e63102

29 files changed

+148
-780
lines changed

frameworks/Rust/vidi/Cargo.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[package]
2+
name = "vidi"
3+
version = "0.1.0"
4+
edition = "2024"
5+
authors = ["Fangdun Tsai <[email protected]>"]
6+
7+
[[bin]]
8+
name = "vidi"
9+
path = "src/main.rs"
10+
11+
[[bin]]
12+
name = "vidi-pg"
13+
path = "src/main_pg.rs"
14+
required-features = ["tokio-postgres", "yarte"]
15+
16+
[dependencies]
17+
vidi = "0.1"
18+
hyper = "1.0"
19+
hyper-util = "0.1"
20+
http-body-util = "0.1"
21+
atoi = "2.0"
22+
serde = { version = "1.0", features = ["derive"] }
23+
serde_json = "1"
24+
mime = "0.3"
25+
rand = { version = "0.9", features = ["small_rng"] }
26+
thiserror = "2.0"
27+
futures-util = "0.3"
28+
socket2 = { version = "0.6.0", features = ["all"] }
29+
num_cpus = "1.0"
30+
31+
[target.'cfg(not(unix))'.dependencies]
32+
nanorand = { version = "0.8" }
33+
34+
[target.'cfg(unix)'.dependencies]
35+
nanorand = { version = "0.8", features = ["getrandom"] }
36+
37+
tokio = { version = "1", features = ["full"] }
38+
tokio-postgres = { version = "0.7", optional = true }
39+
40+
yarte = { version = "0.15", features = ["bytes-buf", "json"], optional = true }
41+
42+
[profile.release]
43+
lto = true
44+
codegen-units = 1
45+
strip = true
46+
opt-level = 3
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# [viz](https://github.com/viz-rs) web framework
1+
# [vidi] web framework
22

33
## Description
44

55
Fast, robust, flexible, lightweight web framework for Rust.
6+
7+
[vidi]: https://github.com/viz-rs/vidi
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"framework": "vidi",
3+
"tests": [
4+
{
5+
"default": {
6+
"json_url": "/json",
7+
"plaintext_url": "/plaintext",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Platform",
11+
"database": "none",
12+
"framework": "Vidi",
13+
"language": "Rust",
14+
"flavor": "None",
15+
"orm": "Raw",
16+
"platform": "Rust",
17+
"webserver": "Hyper",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"display_name": "Vidi",
21+
"notes": "",
22+
"versus": "None"
23+
},
24+
"pg": {
25+
"db_url": "/db",
26+
"fortune_url": "/fortunes",
27+
"query_url": "/queries?q=",
28+
"update_url": "/updates?q=",
29+
"port": 8080,
30+
"approach": "Realistic",
31+
"classification": "Fullstack",
32+
"database": "postgres",
33+
"framework": "Vidi",
34+
"language": "Rust",
35+
"flavor": "None",
36+
"orm": "Raw",
37+
"platform": "Rust",
38+
"webserver": "Hyper",
39+
"os": "Linux",
40+
"database_os": "Linux",
41+
"display_name": "Vidi [Postgresql]",
42+
"notes": "",
43+
"versus": "None"
44+
}
45+
}
46+
]
47+
}

frameworks/Rust/vidi/config.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[framework]
2+
name = "vidi"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Micro"
9+
database = "Postgres"
10+
database_os = "Linux"
11+
os = "Linux"
12+
orm = "Raw"
13+
platform = "None"
14+
webserver = "vidi"
15+
versus = ""
16+
17+
[pg]
18+
urls.db = "/db"
19+
urls.query = "/queries?q="
20+
urls.update = "/updates?q="
21+
urls.fortune = "/fortunes"
22+
approach = "Realistic"
23+
classification = "Fullstack"
24+
database = "Postgres"
25+
database_os = "Linux"
26+
os = "Linux"
27+
orm = "Raw"
28+
platform = "None"
29+
webserver = "vidi"
30+
versus = ""
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::{collections::HashMap, fmt::Write, io, sync::Arc};
22

3-
use futures_util::{stream::FuturesUnordered, StreamExt, TryFutureExt, TryStreamExt};
4-
use rand::{rng, rngs::SmallRng, Rng, SeedableRng};
3+
use futures_util::{StreamExt, TryFutureExt, TryStreamExt, stream::FuturesUnordered};
4+
use rand::{Rng, SeedableRng, rng, rngs::SmallRng};
55
use tokio::pin;
6-
use tokio_postgres::{connect, types::ToSql, Client, NoTls, Statement};
7-
use viz::{Error, IntoResponse, Response, StatusCode};
6+
use tokio_postgres::{Client, NoTls, Statement, connect, types::ToSql};
7+
use vidi::{Error, IntoResponse, Response, StatusCode};
88

99
use crate::models::{Fortune, World};
1010

@@ -21,7 +21,7 @@ pub enum PgError {
2121

2222
impl From<PgError> for Error {
2323
fn from(e: PgError) -> Self {
24-
Error::Responder(e.into_response())
24+
Error::Responder(Box::new(e.into_response()))
2525
}
2626
}
2727

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![allow(clippy::unused_async)]
22

33
use serde::Serialize;
4-
use viz::{
5-
header::{HeaderValue, CONTENT_TYPE, SERVER},
4+
use vidi::{
65
Bytes, Request, Response, ResponseExt, Result, Router,
6+
header::{CONTENT_TYPE, HeaderValue, SERVER},
77
};
88

99
mod server;
@@ -18,7 +18,7 @@ struct Message {
1818
async fn plaintext(_: Request) -> Result<Response> {
1919
let mut res = Response::text("Hello, World!");
2020
res.headers_mut()
21-
.insert(SERVER, HeaderValue::from_static("Viz"));
21+
.insert(SERVER, HeaderValue::from_static("Vidi"));
2222
Ok(res)
2323
}
2424

@@ -36,7 +36,7 @@ async fn json(_: Request) -> Result<Response> {
3636
)
3737
.unwrap();
3838
let headers = res.headers_mut();
39-
headers.insert(SERVER, HeaderValue::from_static("Viz"));
39+
headers.insert(SERVER, HeaderValue::from_static("Vidi"));
4040
headers.insert(
4141
CONTENT_TYPE,
4242
HeaderValue::from_static(mime::APPLICATION_JSON.as_ref()),
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::sync::Arc;
22

3-
use viz::{
3+
use vidi::{
4+
Request, RequestExt, Response, ResponseExt, Result, Router,
45
header::{HeaderValue, SERVER},
56
types::State,
6-
Request, RequestExt, Response, ResponseExt, Result, Router,
77
};
88
use yarte::Template;
99

@@ -12,7 +12,7 @@ mod models;
1212
mod server;
1313
mod utils;
1414

15-
use db_pg::{get_conn, PgConnection};
15+
use db_pg::{PgConnection, get_conn};
1616

1717
#[derive(Template)]
1818
#[template(path = "fortune.hbs")]

0 commit comments

Comments
 (0)