refactor: add better messages
Some checks failed
CI / Tests (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Docs (push) Has been cancelled

This commit is contained in:
2025-08-12 00:04:09 +03:00
parent c4cf6aa25b
commit e20000513a
8 changed files with 83 additions and 2 deletions

View File

@@ -60,12 +60,14 @@ fn extract_named_fields(input: &DeriveInput) -> Result<&FieldsNamed> {
Fields::Named(fields) => Ok(fields),
_ => Err(Error::new_spanned(
&input.ident,
"FromFile can only be derived for structs with named fields",
r#"FromFile only works on structs with *named* fields.
Tuple structs and unit structs are not supported."#,
)),
},
_ => Err(Error::new_spanned(
&input.ident,
"FromFile can only be derived for structs",
r#"FromFile only works on structs.
Enums are not supported."#,
)),
}
}