Skip to content

Commit

Permalink
Remove bunch of allocations from the builders
Browse files Browse the repository at this point in the history
  • Loading branch information
pimeys committed Jun 4, 2018
1 parent b73e09b commit b209961
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 264 deletions.
8 changes: 4 additions & 4 deletions examples/certificate_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ fn main() {
let client = Client::certificate(&mut certificate, &password, endpoint).unwrap();

let options = NotificationOptions {
apns_topic: topic,
apns_topic: topic.as_ref().map(|s| &**s),
..Default::default()
};

// Notification payload
let mut builder = PlainNotificationBuilder::new(message);
let mut builder = PlainNotificationBuilder::new(message.as_ref());
builder.set_sound("default");
builder.set_badge(1u32);

let payload = builder.build(device_token.as_ref(), options);
let sending = client.send(payload);

// Send the notification, parse response
tokio::run(lazy(move || {
client
.send(payload)
sending
.map(|response| {
println!("Sent: {:?}", response);
})
Expand Down
8 changes: 4 additions & 4 deletions examples/token_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,21 @@ fn main() {
).unwrap();

let options = NotificationOptions {
apns_topic: topic,
apns_topic: topic.as_ref().map(|s| &**s),
..Default::default()
};

// Notification payload
let mut builder = PlainNotificationBuilder::new(message);
let mut builder = PlainNotificationBuilder::new(message.as_ref());
builder.set_sound("default");
builder.set_badge(1u32);

let payload = builder.build(device_token.as_ref(), options);
let sending = client.send(payload);

// Send the notification, parse response
tokio::run(lazy(move || {
client
.send(payload)
sending
.map(|response| {
println!("Sent: {:?}", response);
})
Expand Down
Loading

0 comments on commit b209961

Please sign in to comment.