In all cases, look to existing directives to follow established code and test conventions.
parser::keywords
.parser::attrs
. If you need a
new meta-type, add it to parser::meta_types
along with tests.CondEndian
), add
that to a new parser::types
module and export it from parser::types
. New
types must ultimately implement parser::TrySet
, but can sometimes do so
more simply (using trait generic impls) by implementing From
or TryFrom
instead.parser::top_level_attrs
and parser::field_level_attrs
.ReadMode
), add validation in either FromInput::push_field
(if the
validation can occur immediately after the field is constructed) or
FromInput::validate
(if it can only be validated after the entire struct
has been parsed).codegen::read_options
and codegen::write_options
.binrw
crate’s tests
directory.parser::tests
(in mod.rs
) and add
identical trybuild tests to the binrw
crate’s tests/ui
directory. (A
nightly compiler is required to run the trybuild tests; see the comment in
binrw::tests::ui
for more detail.)