Ben Chuanlong Du's Blog

It is never too late to learn.

Cell and RefCell in Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

https://doc.rust-lang.org/std/cell/

https://doc.rust-lang.org/std/cell/struct.RefCell.html

Rust Cell and RefCell

Rc + RefCell is another alternative to circumvent Rust's borrow checker at compile …

Generating Random Numbers in Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Comments

  1. rand::rngs::StdRng (currently, ChaCha block cipher with 12 rounds) is the default recommended RNG which is a trade off among speed, quality and security. While rand::rngs::StdRng is a good default choice as a secure PRNG, it might be too slow for statistical simulations where security is not of a critical concern. rand::rngs::SmallRng

Tips on ZetaSQL

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

ZetaSQL is a customized SQL dialect, along with parser and analyzer, that Google uses for products like BigQuery and Spanner.

unnest

cross join if an implicit join is used. Notice that …

Const Generic in Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. Starting from Rust 1.51, constant generics is supported for integral types.

  2. The crate static_assertions can be used to assert that a const generic parameter satisfy certain conditions at compile time …