echo e210d460c3 | ||
---|---|---|
bind_conf | ||
bind_conf_derive | ||
dns_zone | ||
.gitignore | ||
Cargo.toml | ||
README.md |
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 tobind_conf
but can be useful in case of reexport. -
fallback = "Variant"
used with whenenum
, specifies a fallback variant when a unknown key is encountered, preventing theUnknownVariant
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 exampleparse(alias = "my-alias", alias = "other-alias")
will cause the property to match bothmy-alias
andother-alias
as well as its normal name. Can be combined withrename
. -
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 exampleparse(alias = "my-alias", alias = "other-alias")
will cause the property to match bothmy-alias
andother-alias
as well as its normal name. Can be combined withrename
.