Created
April 23, 2019 05:53
-
-
Save rust-play/c628e8ed34c7b3c85a9a95b31e13189d 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.into()); | |
assert!(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment