This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "fizzbuzz" | |
version = "0.1.0" | |
edition = "2021" | |
[features] | |
use_nightly = [] | |
compare_with_previous_impl = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Expr { | |
Lit(i32), | |
Neg(Box<Self>), | |
Add(Box<Self>, Box<Self>), | |
} | |
fn lit(x: i32) -> Expr { | |
Expr::Lit(x) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(generic_associated_types)] | |
pub struct Data { | |
pub name: String, | |
pub whatever: u32, | |
pub bytes: Vec<u8>, | |
} | |
trait BorrowedKeyFamily { | |
type Key<'a>: Ord + 'a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone)] | |
struct Lexer<'a> { | |
s: &'a str, | |
} | |
impl<'a> Lexer<'a> { | |
fn of(s: &'a str) -> Self { | |
Self { s } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! make_literal_maker { | |
($name:ident : $ty:ident) => { | |
macro_rules! $name { | |
($n:expr) => {{ | |
const fn digits_len(mut n: $ty) -> ::core::primitive::usize { | |
if n == 0 { | |
return 1; | |
} | |
let mut n_digits = 0; | |
#[allow(unused_comparisons)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstddef> | |
#include <cstring> | |
#include <cstdlib> | |
// #define TYPED_TIGHT_MALLOC | |
namespace typed { | |
template <typename T> | |
T* memset_n(T *dest, int ch, std::size_t count) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Z; | |
struct S<T>(T); | |
trait Add<Rhs> { | |
type Sum; | |
} | |
type SumOf<N, M> = <N as Add<M>>::Sum; | |
impl<N> Add<N> for Z { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone, Copy)] | |
pub struct Bounds { | |
rows: usize, | |
cols: usize, | |
} | |
type Pos = (usize, usize); | |
impl Bounds { | |
pub fn around_neumann( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cmp::Ordering; | |
use std::convert::Infallible as Never; | |
use std::fmt::{self, Debug}; | |
struct Z; | |
struct S<T>(T); | |
#[derive(Clone)] | |
struct Node<T, Next> { | |
value: T, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Lexer<'a> { | |
s: &'a str, | |
} | |
type Num = usize; | |
#[derive(Debug)] | |
enum Lexeme<'a> { | |
String(&'a str), | |
Num(Num), |
NewerOlder