Skip to content

Commit

Permalink
Fix Contact definition
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Oct 24, 2024
1 parent 66bd1b3 commit 458a519
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
22 changes: 15 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,22 @@ pub enum License {
},
}

/// Project people contact information
/// A `project.authors` or `project.maintainers` entry.
///
/// Specified in
/// <https://packaging.python.org/en/latest/specifications/pyproject-toml/#authors-maintainers>.
///
/// The entry is derived from the email format of `John Doe <[email protected]>`. 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<String>,
/// A valid email address
pub email: Option<String>,
#[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
Expand Down

0 comments on commit 458a519

Please sign in to comment.