diff --git a/Cargo.lock b/Cargo.lock index 19e64f8..33fca6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,7 +171,7 @@ dependencies = [ [[package]] name = "pyproject-toml" -version = "0.13.0" +version = "0.13.1" dependencies = [ "glob", "indexmap", diff --git a/Cargo.toml b/Cargo.toml index cdfb53c..b2e6d8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyproject-toml" -version = "0.13.0" +version = "0.13.1" description = "pyproject.toml parser in Rust" edition = "2021" license = "MIT" diff --git a/src/lib.rs b/src/lib.rs index 9d9bd3a..027d32c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -154,14 +154,22 @@ pub enum License { }, } -/// Project people contact information +/// A `project.authors` or `project.maintainers` entry. +/// +/// Specified in +/// . +/// +/// The entry is derived from the email format of `John Doe `. You need to +/// provide at least name or email. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] -#[serde(expecting = "a table with 'name' and 'email' keys")] -pub struct Contact { - /// A valid email name - pub name: Option, - /// A valid email address - pub email: Option, +#[serde(untagged, expecting = "a table with 'name' and/or 'email' keys")] +pub enum Contact { + /// TODO(konsti): RFC 822 validation. + Name { name: String }, + /// TODO(konsti): RFC 822 validation. + Email { email: String }, + /// TODO(konsti): RFC 822 validation. + NameEmail { name: String, email: String }, } /// The `[dependency-groups]` section of pyproject.toml, as specified in PEP 735