More content and improve formatting
This commit is contained in:
parent
0d8c15d2e3
commit
652c821c3b
1 changed files with 126 additions and 11 deletions
137
rust_web.org
137
rust_web.org
|
@ -42,7 +42,7 @@
|
||||||
- Performance of idiomatic Rust is comparable to the performance
|
- Performance of idiomatic Rust is comparable to the performance
|
||||||
of idiomatic cpp
|
of idiomatic cpp
|
||||||
|
|
||||||
** Where to get infos
|
** Where to get further information?
|
||||||
|
|
||||||
*** Docs...
|
*** Docs...
|
||||||
- [[https://doc.rust-lang.org/book/][The rust book]] (~$ rustup docs --book~), [[https://doc.rust-lang.org/rust-by-example/][Rust by example]]
|
- [[https://doc.rust-lang.org/book/][The rust book]] (~$ rustup docs --book~), [[https://doc.rust-lang.org/rust-by-example/][Rust by example]]
|
||||||
|
@ -57,16 +57,24 @@
|
||||||
** What are we going to use?
|
** What are we going to use?
|
||||||
|
|
||||||
*** Definitely
|
*** Definitely
|
||||||
- [[https://rocket.rs][rocket]]
|
:PROPERTIES:
|
||||||
- [[https://diesel.rs][diesel]]
|
:BEAMER_col: 0.45
|
||||||
- log
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
- [[https://rocket.rs][rocket]]
|
||||||
|
- [[https://diesel.rs][diesel]]
|
||||||
|
- log
|
||||||
|
|
||||||
*** Maybe
|
*** Maybe
|
||||||
- anyhow
|
:PROPERTIES:
|
||||||
- lettre
|
:BEAMER_col: 0.45
|
||||||
- sha3
|
:BEAMER_env: block
|
||||||
- serde
|
:END:
|
||||||
- chrono
|
- anyhow
|
||||||
|
- lettre
|
||||||
|
- sha3
|
||||||
|
- serde
|
||||||
|
- chrono
|
||||||
|
|
||||||
** How to install
|
** How to install
|
||||||
|
|
||||||
|
@ -119,25 +127,124 @@
|
||||||
- Testing (Unit tests)
|
- Testing (Unit tests)
|
||||||
- Typed URIs
|
- Typed URIs
|
||||||
|
|
||||||
** Where to get infos?
|
** Where to get further information?
|
||||||
|
|
||||||
*** Docs...
|
*** Docs...
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
- [[https://rocket.rs][rocket.rs]]
|
||||||
- [[https://rocket.rs/v0.4/guide/][Rocket Guide]]
|
- [[https://rocket.rs/v0.4/guide/][Rocket Guide]]
|
||||||
- [[https://api.rocket.rs/v0.4/rocket/][Rocket API docs]]
|
- [[https://api.rocket.rs/v0.4/rocket/][Rocket API docs]]
|
||||||
- [[https://github.com/SergioBenitez/Rocket/tree/v0.4/examples][Examples]]
|
- [[https://github.com/SergioBenitez/Rocket/tree/v0.4/examples][Examples]]
|
||||||
|
|
||||||
*** Chat
|
*** Chat
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
- Matrix: [[https://chat.mozilla.org/#/room/%23rocket:mozilla.org][#rocket:mozilla.org]]
|
- Matrix: [[https://chat.mozilla.org/#/room/%23rocket:mozilla.org][#rocket:mozilla.org]]
|
||||||
- IRC on Freenode: [[https://kiwiirc.com/client/chat.freenode.net/#rocket][#rocket]]
|
- IRC on Freenode: [[https://kiwiirc.com/client/chat.freenode.net/#rocket][#rocket]]
|
||||||
|
|
||||||
* Diesel
|
* Diesel
|
||||||
|
|
||||||
** What is an ORM?
|
** What is an ORM?
|
||||||
|
Object-relational-mapping is a programming technique for converting
|
||||||
|
data between incompatible type systems using the paradigms of your
|
||||||
|
programming language.
|
||||||
|
|
||||||
** What is diesel capable of?
|
*** Pros
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
- Models are DRY (don't repeat yourself)
|
||||||
|
- Cleaner separation
|
||||||
|
- Prepared and sanitised queries
|
||||||
|
- Changes are versioned
|
||||||
|
|
||||||
|
*** Cons
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
- Debugging can get more complicated (performance)
|
||||||
|
- No need to learn SQL
|
||||||
|
|
||||||
|
** Prerequisites ~diesel_cli~
|
||||||
|
|
||||||
|
*** Setup Diesel for default DBMS
|
||||||
|
#+BEGIN_SRC sh
|
||||||
|
$ sudo apt install libpq-dev libsqlite3-dev \
|
||||||
|
default-libmysqlclient-dev
|
||||||
|
$ cargo install diesel_cli
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Setup Diesel for SQLite only
|
||||||
|
#+BEGIN_SRC sh
|
||||||
|
$ sudo apt install libsqlite3-dev
|
||||||
|
$ cargo install diesel_cli -no-default-features \
|
||||||
|
--features sqlite
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** How does that look in Rust
|
||||||
|
|
||||||
|
*** Define a struct
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.50
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
#+BEGIN_SRC rust
|
||||||
|
#[derive(Queryable)]
|
||||||
|
pub struct NewComment<'a> {
|
||||||
|
name: &'a str,
|
||||||
|
email: &'a str,
|
||||||
|
comment: &'a str,
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Insert something
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
#+BEGIN_SRC rust
|
||||||
|
let user = NewUser {
|
||||||
|
name: "foo",
|
||||||
|
email: "foo@bar.baz",
|
||||||
|
comment: "A comment",
|
||||||
|
};
|
||||||
|
|
||||||
|
insert_into(comments)
|
||||||
|
.values(&user)
|
||||||
|
.execute(conn);
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Where to get further information?
|
||||||
|
|
||||||
|
*** Docs...
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
- [[https://diesel.rs][diesel.rs]]
|
||||||
|
- [[https://diesel.rs/guides/][Diesel Guides]]
|
||||||
|
- [[https://docs.diesel.rs/master/diesel/index.html][Diesel API docs]]
|
||||||
|
- [[https://github.com/diesel-rs/diesel/tree/master/examples][Examples]] (minimalistic)
|
||||||
|
|
||||||
|
*** Support
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
|
- [[https://gitter.im/diesel-rs/diesel][Gitter]]
|
||||||
|
- [[https://discourse.diesel.rs/][Discourse Forum]]
|
||||||
|
|
||||||
* Lets code something
|
* Lets code something
|
||||||
|
|
||||||
|
** Lets create a small web app
|
||||||
|
|
||||||
* Conclusion
|
* Conclusion
|
||||||
|
|
||||||
** What did we do?
|
** What did we do?
|
||||||
|
@ -147,12 +254,20 @@
|
||||||
** Two small projects
|
** Two small projects
|
||||||
|
|
||||||
*** [[https://git.onders.org/finga/ldap0r][ldap0r]]
|
*** [[https://git.onders.org/finga/ldap0r][ldap0r]]
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
- LDAP password reset tool
|
- LDAP password reset tool
|
||||||
- ($\sim$ 300 SloC)
|
- ($\sim$ 300 SloC)
|
||||||
- First release
|
- First release
|
||||||
- Tests
|
- Tests
|
||||||
|
|
||||||
*** [[https://git.onders.org/finga/filerly][filerly]]
|
*** [[https://git.onders.org/finga/filerly][filerly]]
|
||||||
|
:PROPERTIES:
|
||||||
|
:BEAMER_col: 0.45
|
||||||
|
:BEAMER_env: block
|
||||||
|
:END:
|
||||||
- File sharing a la NextCloud
|
- File sharing a la NextCloud
|
||||||
- Not ready yet, work in progress...
|
- Not ready yet, work in progress...
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue