Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.60 KB | None | 0 0
  1. mod nuconta_hacks {
  2.     pub trait Hackable {
  3.         fn idea(self) -> String;
  4.     }
  5.     pub struct CoolShit<T> {
  6.         cool: T,
  7.     }
  8.     fn coolify<T>(thing: T) -> CoolShit<T> {
  9.         CoolShit { cool: thing }
  10.     }
  11.     fn hack(hack: impl Hackable) -> String {
  12.         hack.idea()
  13.     }
  14.     fn a_ton<T: Clone>(thing: T) -> Vec<T> {
  15.         std::iter::repeat(thing).take(50).collect::<Vec<T>>()
  16.     }
  17.     fn cool_things(idea: impl Hackable) -> Vec<CoolShit<String>> {
  18.         a_ton(
  19.           hack(idea)
  20.         )
  21.         .into_iter()
  22.         .map(coolify)
  23.         .collect()
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement