Skip to content

Instantly share code, notes, and snippets.

@riking
Forked from rust-play/playground.rs
Last active January 30, 2023 22:05
Embed
What would you like to do?
Code shared from the Rust Playground
pub struct Foo;
fn main() {
recheck();
let f = Foo;
let x = f.quux::<{
impl Foo {
pub fn quux<const N: usize>(&self) -> usize {
N
}
}
10
}>();
assert_eq!(x, 10);
}
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