

GitHub - epilys/rsqlite3: sqlite3 Rewritten in RiiR Rust 🦀🦀🦀
source link: https://github.com/epilys/rsqlite3
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

sqlite3 Rewritten in RiiR Rust 


Finally, one of the best written software paired with one of the best writable programming language‽ Fearless and memory safe, since the uncountable amount of unsafe {}
blocks makes you not care anymore.
Build and run
$ cargo +nightly build --release # ... bunch of stuff I choose not to understand/read warning: `rsqlite3` (bin "rsqlite3") generated 37 warnings (24 duplicates) Finished release [optimized] target(s) in 39.84s $ ./target/release/rsqlite3 -- Loading resources from /home/epilys/.sqliterc SQLite version 3.37.0 2021-10-17 10:31:09 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> .open rrrrrruuuuuust.db sqlite> CREATE TABLE opinions(x); sqlite> insert into opinions(x) values (hex(randomblob(16))); sqlite> insert into opinions(x) values (hex(randomblob(16))); sqlite> insert into opinions(x) values (hex(randomblob(16))); sqlite> insert into opinions(x) values (hex(randomblob(16))); sqlite> select * from opinions; x -------------------------------- 343D4BE24D07A96F8550B0942F664A6C D6289536E4A8057EB44754358EACD31A B4CA8E714CB57B11E7336263D214F30F A6491CA289ABF90EB2D76F5E1F919272 sqlite> PRAGMA journal_mode = wal; journal_mode ------------ wal sqlite> PRAGMA integrity_check; integrity_check --------------- ok sqlite> VACUUM; sqlite> ^D
Wait, what?
This is just the sqlite3 code passed throught the
c2rust
transpiler, along with some cleanup from me.
I've found no way to hook it to sqlite3's testing harnesses yet so I doubt it's
completely functional; but opening the shell seems to work.
I am suspicious that a lot of code under ifdefs or not is lost through the transpilation, because the binary size difference is substantial:
$ du -sh $(which sqlite3) 9.5M /home/epilys/.local/bin/sqlite3 $ du -sh target/release/rsqlite3 5.1M target/release/rsqlite3
Recommend
-
67
Hacker News Clone React/GraphQL This project is a clone of hacker news rewritten with universal JavaScript, using React and GraphQL. It is intended to be an example or boilerplate to help you structure your projects using production-ready...
-
28
bb — your system's Big Brother SYNOPSIS bb DESCRIPTION simple process viewer (for functionalities, press h within bb or see shortcuts bel...
-
8
Why fnm was rewritten in Rust...or, why did I rewrite a Reason-native showcase project into Rust?Published at March 05, 2021This blog post...
-
3
buke full text search manpages cargo run --release -- --build builds an sqlite3 database out of all manpages in your $MANPATH cargo run --release -- "query" searches f...
-
6
Files Permalink Latest commit message Commit time
-
6
rlr: a pixel screen ruler Rust + GTK interactive pixel screen ruler with protractor mode. Quit with q or Ctrl-Q. Click to drag. Press r to rotate 90...
-
12
PgCat Meow. PgBouncer rewritten in Rust, with sharding, load balancing and failover support. Alpha: don't use in production just yet. Local development Install Rust (latest stable will wo...
-
11
rustle The Svelte compiler, rewritten in Rust. Reasons My main reason for doing this, is to compile Svelte without Node.js and possibly use Deno instead. Work in progress...
-
7
epilys: "I realised some days ago that …"I realised some days ago that I can include screenshots in git commit messages. Scaling the screenshot down with a small size encoding (like webp) and converting the bytes to a base64 encoded...
-
6
*gerb ʰ-: reconstructed Proto-Indo-European root, meaning to carve gerb: a font editor in gtk...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK