Continue writing report
This commit is contained in:
parent
bc3fe77c93
commit
f36c9fef60
22 changed files with 266 additions and 165 deletions
24
tex/code/Cargo.toml
Normal file
24
tex/code/Cargo.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
[package]
|
||||
name = "thesis-backend"
|
||||
version = "0.1.0"
|
||||
authors = ["Marko Korhonen <marko.korhonen@reekynet.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix-web = "2.0.0"
|
||||
actix-rt = "1.0.0"
|
||||
serde = { version = "1.0.104", features = ["derive"] }
|
||||
diesel = { version = "1.4.3", features = ["mysql", "r2d2", "chrono"] }
|
||||
dotenv = "0.15.0"
|
||||
bcrypt = "0.6.2"
|
||||
env_logger = "0.7.1"
|
||||
r2d2 = "0.8.8"
|
||||
crypto = "0.0.2"
|
||||
jsonwebtoken = "7.1.0"
|
||||
chrono = { version = "0.4.11", features = ["serde"] }
|
||||
actix-cors = "0.2.0"
|
||||
actix-identity = "0.2.1"
|
||||
futures = "0.3.4"
|
||||
actix-files = "0.2.1"
|
10
tex/code/borrow.rs
Normal file
10
tex/code/borrow.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
fn say_hello(name: &String) {
|
||||
println!("Hello {}!", name);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let name = String::from("Marko");
|
||||
say_hello(&name);
|
||||
|
||||
println!("{}", name);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML5 Document Template</title>
|
||||
</head>
|
||||
<body>
|
||||
Some text here (visible to the users)
|
||||
</body>
|
||||
</html>
|
9
tex/code/integer-overflow
Normal file
9
tex/code/integer-overflow
Normal file
|
@ -0,0 +1,9 @@
|
|||
error: literal out of range for `u8`
|
||||
--> types.rs:2:19
|
||||
|
|
||||
2 | let age: u8 = 256;
|
||||
| ^^^
|
||||
|
|
||||
= note: `#[deny(overflowing_literals)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
6
tex/code/jwt.json
Normal file
6
tex/code/jwt.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"sub": 5,
|
||||
"name": "TestUser",
|
||||
"admin": false,
|
||||
"exp": 1588262665
|
||||
}
|
10
tex/code/ownership.rs
Normal file
10
tex/code/ownership.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
fn say_hello(name: String) {
|
||||
println!("Hello {}!", name);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let name = String::from("Marko");
|
||||
say_hello(name);
|
||||
|
||||
println!("{}", name);
|
||||
}
|
3
tex/code/plus.rs
Normal file
3
tex/code/plus.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn plus(num1: i32, num2: i32) -> i32 {
|
||||
num1 + num2
|
||||
}
|
7
tex/code/plus.wat
Normal file
7
tex/code/plus.wat
Normal file
|
@ -0,0 +1,7 @@
|
|||
(module
|
||||
(func $plus (param $num1 i32) (param $num2 i32) (result i32)
|
||||
local.get $num1
|
||||
local.get $num2
|
||||
i32.add)
|
||||
(export "plus" (func $plus))
|
||||
)
|
5
tex/code/registeruser.json
Normal file
5
tex/code/registeruser.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"username": "TestUser",
|
||||
"password": "verysecurepassword",
|
||||
"admin": 3
|
||||
}
|
11
tex/code/registeruser.rs
Normal file
11
tex/code/registeruser.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
struct RegisterUser {
|
||||
username: String,
|
||||
password: String,
|
||||
admin: bool,
|
||||
password_confirmation: String,
|
||||
}
|
||||
|
||||
#[post("/auth/register")]
|
||||
fn register(new_user: actix_web::web::Json<RegisterUser>) -> Result<HttpResponse, HttpResponse> {
|
||||
register(new_user);
|
||||
}
|
2
tex/code/type-inference.rs
Normal file
2
tex/code/type-inference.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
let name = "Marko"; // string slice
|
||||
let age = 26; // integer
|
2
tex/code/type-notation.rs
Normal file
2
tex/code/type-notation.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
let name: &str = "Marko";
|
||||
let age: u8 = 26;
|
Loading…
Add table
Add a link
Reference in a new issue