Module util

Source
Expand description

Utility types for attribute parsing.

Modules§

parse_expr
Functions to use with #[darling(with = "...")] that control how quoted values in Meta instances are parsed into Expr fields.

Structs§

Flag
A meta-item that can be present as a word - with no value - or absent.
IdentString
A wrapper for an Ident which also keeps the value as a string.
Ignored
An efficient way of discarding data from a syntax element.
PathList
A list of syn::Path instances. This type is used to extract a list of paths from an attribute.
ShapeSet
A set of Shape values, which correctly handles the relationship between newtype and tuple shapes.
SpannedValue
A value and an associated position in source code. The main use case for this is to preserve position information to emit warnings from proc macros. You can use a SpannedValue<T> as a field in any struct that implements or derives any of darling’s core traits.
WithOriginal
A container to parse some syntax and retain access to the original.

Enums§

Override
A value which can inherit a default value or have an explicit value specified.
Shape
Description of how fields in a struct or variant are syntactically laid out.

Traits§

AsShape
Get the “shape” of a fields container, such as a struct or variant.

Functions§

parse_attribute_to_meta_list
Try to parse an attribute into a meta list. Path-type meta values are accepted and returned as empty lists with their passed-in path. Name-value meta values and non-meta attributes will cause errors to be returned.
path_to_string
Transform Rust paths to a readable and comparable string.