Expand description
Turning a value’s bytes into a Rust type.
A field’s type says how its value is read, through FromArg:
| Type | Reads |
|---|---|
String, char, bool, integers, floats, std::net addresses | UTF-8 text, parsed with str::parse |
PathBuf, OsString | the bytes as they are on Unix, UTF-8 elsewhere |
Vec<u8> | the bytes as they are |
an enum deriving ValueEnum | one of its variants’ names |
Parsed<T> | any T: FromStr, a type from another crate included |
CInt<T> | an integer in C syntax: 0x400000, 010000 |
KeyValue<K, V> | key=value, split at the first = |
Any other type implements FromArg itself. In an Occurrence variant,
Spanned<T> is a T with where it was found.
Structs§
- CInt
- An integer in C syntax, as linkers and assemblers read one:
0x/0Xhex, a leading0for octal, otherwise decimal, with a sign for signed types.--image-base=0x400000,-z max-page-size=0x1000,-Ttext=010000. - CInt
Error - The error of a malformed
CInt. - Choice
Error - The cause of an
ErrorKind::InvalidChoice: the value is not one ofchoices. - KeyValue
key=value, split at the first=:--defsym=sym=expr,-z max-page-size=4096,--section-start=.text=0x1000. The value may hold more=.- Missing
Equals - The error of a
KeyValuewith no=. - Parsed
- Any
FromStrtype as a value: the text is parsed withstr::parse, and its error becomes the invalid value’s cause. - Spanned
- A value with where it was found: an
Occurrencevariant holding aSpanned<T>gets the flag’s (or word’s) offset and whether the value was attached (-zfoo,--name=value) or the next word (-z foo).
Traits§
- FromArg
- A type a flag’s value can be converted into.
Functions§
- to_str
- The value as
&str.