Skip to content

Commit b08ff77

Browse files
refactor: rename email to email address
1 parent 7e605fa commit b08ff77

42 files changed

Lines changed: 266 additions & 212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

benchmarks/compile/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ validator = ["dep:validator"]
1717

1818
[dependencies]
1919
fortifier = { workspace = true, features = [
20-
"email",
20+
"email-address",
2121
"serde",
2222
"url",
2323
], optional = true }

book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- [Enum](./validate/enum.md)
88
- [Struct](./validate/struct.md)
99
- [Validations](./validations/README.md)
10-
- [Email](./validations/email.md)
10+
- [Email Address](./validations/email-address.md)
1111
- [Length](./validations/length.md)
1212
- [Phone Number](./validations/phone-number.md)
1313
- [Regex]()

book/src/getting-started.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Add Fortifier to your project:
66

77
```shell
8-
cargo add fortifier --features email
8+
cargo add fortifier --features email-address
99
```
1010

1111
See [Installation](installation.md) for more details.
@@ -46,7 +46,7 @@ use fortifier::Validate;
4646

4747
#[derive(Validate)]
4848
struct CreateUser {
49-
#[validate(email)]
49+
#[validate(email_address)]
5050
email_address: String,
5151

5252
#[validate(length(min = 1, max = 256))]
@@ -62,11 +62,11 @@ Call the `validate_sync` method on the data structure:
6262

6363
```rust
6464
# extern crate fortifier;
65-
use fortifier::{EmailError, LengthError, Validate, ValidationErrors};
65+
use fortifier::{EmailAddressError, LengthError, Validate, ValidationErrors};
6666

6767
#[derive(Validate)]
6868
struct CreateUser {
69-
#[validate(email)]
69+
#[validate(email_address)]
7070
email_address: String,
7171

7272
#[validate(length(min = 1, max = 256))]
@@ -90,7 +90,7 @@ fn main() {
9090
data.validate_sync(),
9191
Err(ValidationErrors::from_iter([
9292
CreateUserValidationError::EmailAddress(
93-
EmailError::MissingSeparator {},
93+
EmailAddressError::MissingSeparator {},
9494
),
9595
CreateUserValidationError::Name(
9696
LengthError::Min {

book/src/installation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ cargo add fortifier
2222
### Validations
2323

2424
- `all-validations` - Enable all features below.
25-
- `email` - Email address validation using the [`email_address`](https://docs.rs/email_address/latest/email_address/) crate.
25+
- `email-address` - Email address validation using the [`email_address`](https://docs.rs/email_address/latest/email_address/) crate.
26+
- `phone-number` - Phone number validation using the [`phonenumber`](https://docs.rs/phonenumber/latest/phonenumber/) crate.
2627
- `regex` - Regular expression validation using the [`regex`](https://docs.rs/regex/latest/regex/) crate.
2728
- `url` - URL validation using the [`url`](https://docs.rs/url/latest/url/) crate.
2829

book/src/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Schema validation.
66
- Enums & structs
77
- Typed errors
88
- Built-in validations
9-
- Email
9+
- Email address
1010
- Length
1111
- Phone number
1212
- Regex

book/src/validations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Validations
22

3-
- [Email](./email.md)
3+
- [Email Address](./email-address.md)
44
- [Length](./length.md)
55
- [Phone Number](./phone-number.md)
66
- [URL](./url.md)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Email
1+
# Email Address
22

33
> [!NOTE]
4-
> Requires the `email` feature.
4+
> Requires the `email-address` feature.
55
66
Validate a string is an RFC-compliant email address using the [`email_address`](https://docs.rs/email_address/latest/email_address/) crate.
77

@@ -11,7 +11,7 @@ Validate a string is an RFC-compliant email address using the [`email_address`](
1111
#
1212
##[derive(Validate)]
1313
struct User {
14-
#[validate(email)]
14+
#[validate(email_address)]
1515
email_address: String
1616
}
1717
```
@@ -47,7 +47,7 @@ See [`Options::allow_display_text`](https://docs.rs/email_address/latest/email_a
4747
#
4848
##[derive(Validate)]
4949
struct User<'a> {
50-
#[validate(email(allow_display_text = false))]
50+
#[validate(email_address(allow_display_text = false))]
5151
email_address: &'a str
5252
}
5353

@@ -76,7 +76,7 @@ See [`Options::allow_domain_literal`](https://docs.rs/email_address/latest/email
7676
#
7777
##[derive(Validate)]
7878
struct User<'a> {
79-
#[validate(email(allow_domain_literal = false))]
79+
#[validate(email_address(allow_domain_literal = false))]
8080
email_address: &'a str
8181
}
8282

@@ -105,7 +105,7 @@ See [`Options::minimum_sub_domains`](https://docs.rs/email_address/latest/email_
105105
#
106106
##[derive(Validate)]
107107
struct User<'a> {
108-
#[validate(email(minimum_sub_domains = 2))]
108+
#[validate(email_address(minimum_sub_domains = 2))]
109109
email_address: &'a str
110110
}
111111

examples/basic/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ version.workspace = true
1010

1111
[dependencies]
1212
fortifier = { workspace = true, features = [
13-
"email",
13+
"email-address",
1414
"phone-number",
1515
"regex",
1616
"url",

examples/basic/src/email_address.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use fortifier::Validate;
33
#[derive(Validate)]
44
pub enum ChangeEmailAddressRelation {
55
Create {
6-
#[validate(email)]
6+
#[validate(email_address)]
77
email_address: String,
88
},
99
Update {
1010
id: String,
1111

12-
#[validate(email)]
12+
#[validate(email_address)]
1313
email_address: String,
1414
},
1515
Delete {

examples/basic/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{email_address::ChangeEmailAddressRelation, user::CreateUser};
1111
async fn main() -> Result<(), Box<dyn Error>> {
1212
let data = CreateUser {
1313
name: "John Doe".to_owned(),
14-
email: "john@doe.com".to_owned(),
14+
email_address: "john@doe.com".to_owned(),
1515
phone_number: "+44 20 7946 0000".to_owned(),
1616
url: "https://john.doe.com".to_owned(),
1717
country_code: "GB".to_owned(),

0 commit comments

Comments
 (0)