Created
April 23, 2019 05:52
-
-
Save rust-play/87a4cc73a30d92d7bfef5a4b502907c4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
#![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