Bind9 configuration parsing library
Go to file
echo e210d460c3 move parse error out of error type 2020-09-20 23:48:53 -04:00
bind_conf Change ip addresses in tests to be in networks defined in RFCs 3849 and 5737 2019-10-15 10:16:44 -04:00
bind_conf_derive option flattening is now stable 2020-04-29 13:25:56 -04:00
dns_zone move parse error out of error type 2020-09-20 23:48:53 -04:00
.gitignore Init repo 2019-08-01 10:01:05 -04:00
Cargo.toml Create dns master zone files parser lib 2019-11-27 23:08:33 -05:00
README.md Add readme 2019-10-10 14:22:55 -04:00

README.md

Bind9 configuration parsing library

Parse derive macro

The Parse derive macro can ease a lot Parse trait implementation on common types and prevents a lot of boilerplate code.

Attributes

Attributes can allow better configuration of the way the types should be parsed. They can be used as follow:

#[derive(Parse)]
#[parse(global_attr = "my value")]
struct MyStruct {

  #[parse(struct_attr)]
  my_property: String
}

Global

Those attributes can be applied directly on type definition.

  • path = "path::to::bind_conf" specifies the path to this crate, default to bind_conf but can be useful in case of reexport.

  • fallback = "Variant" used with when enum, specifies a fallback variant when a unknown key is encountered, preventing the UnknownVariant error.

Structures

Those attributes can be applied on structure properties.

  • rename = "my-other-name" default renaming rules change Rust snake case for kebab case, this is useful when you need a totally different name, for example to avoid conflicting with some reserved key words.

  • alias = "my-alias" used when a statement can have different names, note that it can be used more than once, for example parse(alias = "my-alias", alias = "other-alias") will cause the property to match both my-alias and other-alias as well as its normal name. Can be combined with rename.

  • inline flag to indicate that the statement will be inline.

  • default = "path::to::a_function" use the defined function to get the property value if it was missing, the function must have no arguments, works for inline and block statements.

Enumerations

Those attributes can be applied on enumeration variants.

  • rename = "my-other-name" default renaming rules change Rust snake case for kebab case, this is useful when you need a totally different name, for example to avoid conflicting with some reserved key words.

  • alias = "my-alias" used when a statement can have different names, note that it can be used more than once, for example parse(alias = "my-alias", alias = "other-alias") will cause the property to match both my-alias and other-alias as well as its normal name. Can be combined with rename.