Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct Doc;
#[cfg(not(phantom))]
struct Node<'a> {
doc: &'a Doc
}
#[cfg(phantom)]
struct Node<'a>;
impl Doc {
#[cfg(phantom)]
fn node<'a>(&'a self) -> Node<'a> {
Node
}
#[cfg(not(phantom))]
fn node<'a>(&'a self) -> Node<'a> {
Node { doc: self }
}
}
fn main() {
let node;
{
let doc = Doc;
node = doc.node();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.