Skip to content

Instantly share code, notes, and snippets.

@peter-lyons-kehl
peter-lyons-kehl / rust_const_generics.md
Last active March 28, 2024 15:07
Rust Const Generics

Presentation on Const Generics as of 1.50.0 stable and 1.52.0-nightly

Challenges

  • Beware no, or misleading, documentation
  • Syntax may seem arbitrary:
    • Need ::< turbofish at some places, ordinary < elsewhere.
    • Need {...} curly brackets around some const generic parameter values, not around others.
    • Some error messages feel like going in circles.
use std::collections::HashMap;
use std::fmt;
use std::io;
use std::num::ParseFloatError;
use std::rc::Rc;
/*
Types
*/