Currently, it's difficult to discover all flags of a type without looking at the source. For example, if I want to find all possible WriteFlags values when writing code to put a value into a database, I open the flags.rs source file and look at the bitflags macro that defines them. Ditto when I need to find the possible values for DatabaseFlags and EnvironmentFlags.
Instead, the rustdoc-generated documentation should list all flags of a type in one place. I'm not sure where and how, but here are some ideas:
List all relevant flag constants in the type definition (e.g., in the description for WriteFlags, list out APPEND, APPEND_DUP, CURRENT, etc.).
Create a submodule for each flag type, which would force the documentation to group flags together by type.
Explicitly describe the flags and what they do in the description for each method that has a flag parameter. For example, in the RwTransaction::put method, specify all WriteFlags values and what effect they have.
Items 1 and 2, above, are the easiest to implement, though I think item 3 gives the best user experience. Of course, the items aren't mutually exclusive and good documentation is often repetitive instead of maximally concise.
23 updated bitflags to 1.0, which I believe fixes this issue. Flags are now grouped as constants under a struct, which serves as a namespace. Please feel free to re-open if this isn't what you had in mind.
Currently, it's difficult to discover all flags of a type without looking at the source. For example, if I want to find all possible
WriteFlags
values when writing code to put a value into a database, I open theflags.rs
source file and look at thebitflags
macro that defines them. Ditto when I need to find the possible values forDatabaseFlags
andEnvironmentFlags
.Instead, the rustdoc-generated documentation should list all flags of a type in one place. I'm not sure where and how, but here are some ideas:
WriteFlags
, list outAPPEND
,APPEND_DUP
,CURRENT
, etc.).RwTransaction::put
method, specify allWriteFlags
values and what effect they have.Items 1 and 2, above, are the easiest to implement, though I think item 3 gives the best user experience. Of course, the items aren't mutually exclusive and good documentation is often repetitive instead of maximally concise.
Here are all affected flag types:
DatabaseFlags
EnvironmentFlags
WriteFlags