Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created April 23, 2019 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/87a4cc73a30d92d7bfef5a4b502907c4 to your computer and use it in GitHub Desktop.
Save rust-play/87a4cc73a30d92d7bfef5a4b502907c4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
#![allow(dead_code)]
#![allow(unused_variables)]
struct IndiciesSource;
struct NoIndicies;
impl From<NoIndicies> for IndiciesSource {
fn from(_: NoIndicies) -> Self {
IndiciesSource
}
}
fn thing(a_thing: IndiciesSource) {
println!("Read a thing.");
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn do_thing() {
let what_a_thing = NoIndicies;
thing(what_a_thing);
assert!(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment