syntax: Add ToTokens for Option<T>
This commit is contained in:
parent
d3adccda4e
commit
eddc3ccce8
|
@ -67,6 +67,15 @@ pub mod rt {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: ToTokens> ToTokens for Option<T> {
|
||||
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
|
||||
match self {
|
||||
&Some(ref t) => t.to_tokens(cx),
|
||||
&None => Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Should be (when bugs in default methods are fixed):
|
||||
|
||||
trait ToSource : ToTokens {
|
||||
|
|
Loading…
Reference in New Issue