Bind9 configuration parsing library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Gaël Berthaud-Müller e210d460c3 move parse error out of error type 1 year ago
bind_conf Change ip addresses in tests to be in networks defined in RFCs 3849 and 5737 2 years ago
bind_conf_derive option flattening is now stable 1 year ago
dns_zone move parse error out of error type 1 year ago
.gitignore Init repo 2 years ago
Cargo.toml Create dns master zone files parser lib 2 years ago
README.md Add readme 2 years ago

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.