Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: derive more #80

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
[package]
name = "sendgrid"
version = "0.15.0"
edition = "2018"
authors = ["Garrett Squire <github@garrettsquire.com>"]
description = "An unofficial client library for the SendGrid API"
repository = "https://github.com/gsquire/sendgrid-rs"
license = "MIT"
homepage = "https://sendgrid.com"
keywords = ["email"]
authors = ["Garrett Squire <github@garrettsquire.com>"]
description = "An unofficial client library for the SendGrid API"
documentation = "https://docs.rs/sendgrid"
readme = "README.md"
edition = "2018"
homepage = "https://sendgrid.com"
keywords = ["email"]
license = "MIT"
name = "sendgrid"
readme = "README.md"
repository = "https://github.com/gsquire/sendgrid-rs"
version = "0.15.0"

[dependencies]
data-encoding = "2.1"
reqwest = { version = "0.10", default-features = false, features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
url = "2.1"
reqwest = { version = "0.10", default-features = false, features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0"
url = "2.1"

[dev-dependencies]
tokio = { version = "0.3", features = ["full"] }

[features]
default = ["native-tls", "blocking"]
default = ["native-tls", "async"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave the blocking option as default and let people opt into using async.

Also, is there any way to undo the formatting that changed here?


async = []
blocking = ["reqwest/blocking"]
rustls = ["reqwest/rustls-tls"]
async = []
blocking = ["reqwest/blocking"]
native-tls = ["reqwest/default-tls"]
rustls = ["reqwest/rustls-tls"]

[[example]]
name = "v3_async"
name = "v3_async"
required-features = ["async"]

[[example]]
name = "main"
name = "main"
required-features = ["blocking"]

[[example]]
name = "v3"
name = "v3"
required-features = ["blocking"]
2 changes: 1 addition & 1 deletion src/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<'a> Mail<'a> {
add_reply_to = reply_to: &'a str
);

// TODO(richo) Should this be a chronos::Utc ?
// TODO(richo) Should this be a chrono::Utc ?
add_field!(
/// Set the date for the message. This must be a valid RFC 822 timestamp.
add_date = date: &'a str
Expand Down
12 changes: 6 additions & 6 deletions src/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct Sender {

/// The main structure for a V3 API mail send call. This is composed of many other smaller
/// structures used to add lots of customization to your message.
#[derive(Serialize)]
#[derive(Clone, Debug, Serialize)]
pub struct Message {
from: Email,
subject: String,
Expand All @@ -45,7 +45,7 @@ pub struct Message {
}

/// An email with a required address and an optional name field.
#[derive(Clone, Serialize)]
#[derive(Clone, Debug, Serialize)]
pub struct Email {
email: String,

Expand All @@ -54,7 +54,7 @@ pub struct Email {
}

/// The body of an email with the content type and the message.
#[derive(Clone, Default, Serialize)]
#[derive(Clone, Default, Debug, Serialize)]
pub struct Content {
#[serde(rename = "type")]
content_type: String,
Expand All @@ -63,7 +63,7 @@ pub struct Content {

/// A personalization block for a V3 message. It has to at least contain one email as a to
/// address. All other fields are optional.
#[derive(Serialize)]
#[derive(Clone, Default, Debug, Serialize)]
pub struct Personalization {
to: Vec<Email>,

Expand Down Expand Up @@ -96,7 +96,7 @@ pub struct Personalization {
/// displayed. For example, inline results in the attached file being displayed automatically
/// within the message. By specifying attachment, it will prompt the user to either view or
/// download the file.
#[derive(Clone, Copy, Serialize)]
#[derive(Clone, Copy, Debug, Serialize)]
pub enum Disposition {
/// Displayed automatically within the message.
#[serde(rename = "inline")]
Expand All @@ -110,7 +110,7 @@ pub enum Disposition {
/// An attachment block for a V3 message. Content and filename are required. If the
/// mime_type is unspecified, the email will use Sendgrid's default for attachments
/// which is 'application/octet-stream'.
#[derive(Default, Serialize)]
#[derive(Clone, Default, Debug, Serialize)]
pub struct Attachment {
content: String,

Expand Down