Skip to content

Instantly share code, notes, and snippets.

@redgoldlace
Created April 13, 2022 00:34
Show Gist options
  • Save redgoldlace/6796fa3b40fa18fd0dc1fe939c954e92 to your computer and use it in GitHub Desktop.
Save redgoldlace/6796fa3b40fa18fd0dc1fe939c954e92 to your computer and use it in GitHub Desktop.
#![allow(non_upper_case_globals)]
fn main() {
dots_and_barrels();
}
#[rustfmt::skip]
fn dots_and_barrels() -> DottyBarrel {
r.r.r.0 .u.0.0.u .0.s.s.s.s .t.t.t.t.t
.r.0.0.r .u.0.0.u .s.0.0.0.0 .0.0.t.0.0
.r.r.r.0 .u.0.0.u .s.s.s.s.s .0.0.t.0.0
.r.0.0.r .u.0.0.u .0.0.0.0.s .0.0.t.0.0
.r.0.0.r .u.u.u.u .s.s.s.s.0 .0.0.t.0.0
}
// ...
use std::ops::Deref;
static bart: Barrel = Barrel(DottyBarrel);
static r: Dotty = Dotty {
r: bart,
u: bart,
s: bart,
t: bart,
};
#[derive(Clone, Copy)]
struct Dotty {
r: Barrel,
u: Barrel,
s: Barrel,
t: Barrel,
}
#[derive(Clone, Copy)]
struct Barrel(DottyBarrel);
impl Deref for Barrel {
type Target = Dotty;
fn deref(&self) -> &Self::Target {
&r
}
}
#[derive(Clone, Copy)]
struct DottyBarrel;
impl Deref for DottyBarrel {
type Target = Barrel;
fn deref(&self) -> &Self::Target {
&bart
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment