1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
19 pub fn flag<'r>(name: &'r str, desc: &'r str) -> Flag<'r> {
20 Flag { name: name, desc: desc, max_count: 1, value: 0 }
24 pub fn set_desc(self, s: &str) -> Flag<'a> {
25 Flag { //~ ERROR cannot infer
28 max_count: self.max_count,
36 let f : argparse::Flag = argparse::flag(~"flag", ~"My flag");
37 let updated_flag = f.set_desc(~"My new flag");
38 assert_eq!(updated_flag.desc, "My new flag");