Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
fn repeat(f: impl FnMut(usize), n: usize) {
(0..n).for_each(f);
}

View file

@ -0,0 +1,3 @@
fn main() {
repeat(|x| print!("{};", x), 5);
}

View file

@ -0,0 +1,7 @@
fn function(x: usize) {
print!("{};", x);
}
fn main() {
repeat(function, 4);
}

View file

@ -0,0 +1,10 @@
struct Foo;
impl Foo {
fn associated(x: usize) {
print!("{};", x);
}
}
fn main() {
repeat(Foo::associated, 8);
}

View file

@ -0,0 +1,13 @@
trait Bar {
fn run(self);
}
impl Bar for usize {
fn run(self) {
print!("{};", self);
}
}
fn main() {
repeat(Bar::run, 6);
}

View file

@ -0,0 +1,11 @@
fn repeat(f: impl FnMut(usize), n: usize) {
(0..n).for_each(f);
}
fn main() {
let mut mult = 1;
repeat(|x| {
print!("{};", x * mult);
mult += x;
}, 5);
}