debian_control

Function parse_identity

source
pub fn parse_identity(s: &str) -> Result<(&str, &str), ParseIdentityError>
Expand description

Parse an identity string into a name and an email address.

The input string should be in the format Name <email>. If the email is missing, an error is returned.

§Example

use debian_control::parse_identity;
assert_eq!(parse_identity("Joe Example <joe@example.com>"), Ok(("Joe Example", "joe@example.com")));

§Arguments

  • s - The input string.

§Returns

A tuple with the name and the email address.