-
-
Save rust-play/c40682d4d0ee67d970933f63cc1d8615 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains hidden or 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
pub struct Foo; | |
fn main() { | |
let f = Foo; | |
let x = f.quux::<{ | |
impl Foo { | |
pub fn quux<const N: usize>(&self) -> usize { | |
N | |
} | |
} | |
10 | |
}>(); | |
assert_eq!(x, 10); | |
} | |
#[allow(dead_code)] | |
fn recheck() { | |
let f = Foo; | |
assert_eq!(f.quux::<10>(), 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment