rust-lang-nursery / lazy-static.rs

A small macro for defining lazy evaluated static variables in Rust.
Apache License 2.0
1.93k stars 112 forks source link

Cannot use tuples #51

Closed nathansizemore closed 7 years ago

nathansizemore commented 8 years ago

Unless I just have the syntax wrong? I've tried both:

static (ref x, ref y): (u8, u8) = (5u8, 6u8); static ref (x, y): (u8, u8) = (5u8, 6u8);

chpio commented 8 years ago

(x, y) should be the name, i guess.

lazy_static! {
    static ref FOO: (u8, u8) = (5, 6);
}

For a given static ref NAME: TYPE = EXPR;, the macro generates a unique type that implements Deref and stores it in a static with name NAME.

evanmcc commented 7 years ago

I could also use this.

Kimundi commented 7 years ago

Hi, I'm sincerely sorry for taking so long to respond.

lazy static mirrors the syntax of Rusts regular statics, which do not allow pattern matching either. As such, I do not plan to add this feature, sorry. :)