-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
is it possible to 'map' or 'validate' a field using custom parsing logic?
My specific use case is to prepend a root directory to a provided PathBuf.
(The root directory should be provided by an environment variable and the compilation should fail if the environment variable is not present)
I guess what i'm looking for is something like darling's 'map' attribute.
#[derive(deluxe::ParseAttributes)]
pub struct DeriveAttributes {
#[deluxe(map = parse_path)]
path: PathBuf,
}
fn parse_path(s: String) -> Result<PathBuf, SomeError> {
let prefix = Path::new(std::env::var("SOME_ARG").map_err(|_| SomeError)?);
prefix.join(s)
}(or something)
Metadata
Metadata
Assignees
Labels
No labels