getopts: Switch field privacy as necessary

This commit is contained in:
Alex Crichton 2014-03-27 15:10:18 -07:00
parent 8ad7e5481f
commit 5f33588d75
1 changed files with 16 additions and 13 deletions

View File

@ -87,6 +87,8 @@
#![deny(missing_doc)]
#![deny(deprecated_owned_vector)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
#[cfg(test)] #[phase(syntax, link)] extern crate log;
use std::cmp::Eq;
@ -130,13 +132,13 @@ pub enum Occur {
#[deriving(Clone, Eq)]
pub struct Opt {
/// Name of the option
name: Name,
pub name: Name,
/// Whether it has an argument
hasarg: HasArg,
pub hasarg: HasArg,
/// How often it can occur
occur: Occur,
pub occur: Occur,
/// Which options it aliases
priv aliases: Vec<Opt> ,
pub aliases: Vec<Opt> ,
}
/// One group of options, e.g., both -h and --help, along with
@ -144,17 +146,17 @@ pub struct Opt {
#[deriving(Clone, Eq)]
pub struct OptGroup {
/// Short Name of the `OptGroup`
short_name: ~str,
pub short_name: ~str,
/// Long Name of the `OptGroup`
long_name: ~str,
pub long_name: ~str,
/// Hint
hint: ~str,
pub hint: ~str,
/// Description
desc: ~str,
pub desc: ~str,
/// Whether it has an argument
hasarg: HasArg,
pub hasarg: HasArg,
/// How often it can occur
occur: Occur
pub occur: Occur
}
/// Describes wether an option is given at all or has a value.
@ -169,11 +171,12 @@ enum Optval {
#[deriving(Clone, Eq)]
pub struct Matches {
/// Options that matched
priv opts: Vec<Opt> ,
opts: Vec<Opt> ,
/// Values of the Options that matched
priv vals: Vec<Vec<Optval> > ,
vals: Vec<Vec<Optval> > ,
/// Free string fragments
free: Vec<~str> }
pub free: Vec<~str>,
}
/// The type returned when the command line does not conform to the
/// expected format. Call the `to_err_msg` method to retrieve the