#[derive(Debug, Snafu)]
#[snafu(module)]
enum Error { Alpha }
By default, should that generate
mod error {
#!/bin/bash | |
set -eu | |
shopt -s nullglob | |
readonly base_dir=/var/local/docker-registry | |
readonly output_dir=$(mktemp -d -t trace-images-XXXX) | |
readonly jq=/tmp/jq | |
readonly repository_dir=$base_dir/repositories |
#![feature(coroutines, coroutine_trait)] | |
use snafu::prelude::*; | |
use std::{ | |
ops::{Coroutine, CoroutineState}, | |
pin::pin, | |
str, | |
}; | |
#[derive(Debug, Copy, Clone)] |
//! This crate provides types for UCD’s `Blocks.txt`. | |
pub struct Blocks { | |
ranges: Vec<(RangeInclusive<u32>, String)>, | |
} | |
impl Blocks { | |
pub fn block_of(&self, c: char) -> &str { | |
self.ranges | |
.binary_search_by(|(range, _)| { |
#[derive(Debug, Snafu)]
#[snafu(module)]
enum Error { Alpha }
By default, should that generate
mod error {
Here's two implementations of a binary search tree in OCaml and Rust. The Rust version was written to
deliberately look as close to the OCaml as possible (and it'd get pretty close if I used match
instead of OCaml's variants). I'm pretty sure my OCaml implementation is idiomatic, and I'd like some advice on
what steps I'd probably take to make the Rust example more idiomatic. My objective is to talk about how
close the examples can be to each other as well as how different the examples can be (hopefully demonstrating
strengths for both.)
Any other thoughts or ideas are also helpful and super appreciated!
// This code was saved by an automated test for the Rust Playground |
// This code was saved by an automated test for the Rust Playground |
// This code was saved by an automated test for the Rust Playground |
// This code was saved by an automated test for the Rust Playground |
// This code was saved by an automated test for the Rust Playground |