Skip to content

Instantly share code, notes, and snippets.

View jonhoo's full-sized avatar
Permanent 418 status code.

Jon Gjengset jonhoo

Permanent 418 status code.
View GitHub Profile
jonhoo /
Created January 10, 2023 02:45
Living with Rust Long-Term abstract

Living with Rust Long-Term

Rust and its ecosystem are, seemingly, in constant flux. And this appearance of perpetual motion can be scary, especially when you're building an application with stability and long-term project sustainability in mind. New Rust versions bring ever-higher editions, must-have new features, and lint and tool changes to keep on top of. And as new features get adopted, new crates and major versions emerge, leaving once-vibrant ecosystems to fade into oblivion. All this happens while the software ecosystem surrounding and underpinning Rust continues its relentless march forward.

In this talk, we'll take a look at the kinds of changes that may happen under you when working with Rust and how to live with them. We'll talk about Rust and crate versioning, but also backwards compatibility, unstable features, minimum supported Rust versions, and 1.0 releases. This talk is geared towards those using Rust to build applications and services, not those building Rust libraries. It won't tell you

[START][2022-12-02 20:14:20] LSP logging initiated
[INFO][2022-12-02 20:14:20] .../vim/lsp/rpc.lua:261 "Starting RPC client" {
args = {},
cmd = "rust-analyzer",
extra = {
cwd = "/local/home/jongje/dev/tmp/consumer-of-needs-nightly"
[TRACE][2022-12-02 20:14:20] .../lua/vim/lsp.lua:953 "LSP[rust_analyzer]" "initialize_params" {
capabilities = {
if [[ $# -gt 0 && $1 == "-n" ]]; then
if [[ $# -gt 0 ]]; then
if [[ $1 = -* || $# -gt 1 ]]; then
use std::collections::VecDeque;
use std::sync::{Arc, Condvar, Mutex};
// Flavors:
// - Synchronous channels: Channel where send() can block. Limited capacity.
// - Mutex + Condvar + VecDeque
// - Atomic VecDeque (atomic queue) + thread::park + thread::Thread::notify
// - Asynchronous channels: Channel where send() cannot block. Unbounded.
// - Mutex + Condvar + VecDeque
// - Mutex + Condvar + LinkedList
jonhoo /
Last active May 13, 2024 09:58
// these aren't _quite_ functional tests,
// and should all be compile_fail,
// but may be illustrative
fn concurrent_set() {
use std::sync::Arc;
let x = Arc::new(Cell::new(42));
let x1 = Arc::clone(&x);
std::thread::spawn(move || {

Hi there!

I'm looking for a mascot to use with my [YouTube] and [Twitch] channels. Unlike seemingly many of the channels out there, mine is not gaming related, but is instead a place where I do live programming videos with an educational focus on the [Rust programming language].

My want for a mascot is particularly tied to a new series of streams I've started doing called "Crust of Rust". I think the name is cute, and warrants a mascot, though I'd like to also use the mascot for the rest of my channel.

pub trait IteratorExt: Iterator + Sized {
fn our_flatten(self) -> Flatten<Self>
Self::Item: IntoIterator;
impl<T> IteratorExt for T
T: Iterator,
fn our_flatten(self) -> Flatten<Self>
macro_rules! avec {
($($element:expr),*) => {{
// check that count is const
const C: usize = $crate::count![@COUNT; $($element),*];
let mut vs = Vec::with_capacity(C);
pub struct StrSplit<'haystack, D> {
remainder: Option<&'haystack str>,
delimiter: D,
impl<'haystack, D> StrSplit<'haystack, D> {
pub fn new(haystack: &'haystack str, delimiter: D) -> Self {
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
<atom:link href="{{ site.url }}{{ page.url }}" rel="self" type="application/rss+xml" />
<link>{{ site.url }}</link>