Skip to content

Commit 128aef4

Browse files
authored
Added Context::deadline(&self) -> SystemTime (#583)
1 parent ab4c2b3 commit 128aef4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lambda-runtime/src/types.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use crate::{Config, Error};
22
use http::{HeaderMap, HeaderValue};
33
use serde::{Deserialize, Serialize};
4-
use std::{collections::HashMap, convert::TryFrom};
4+
use std::{
5+
collections::HashMap,
6+
convert::TryFrom,
7+
time::{Duration, SystemTime},
8+
};
59

610
#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
711
#[serde(rename_all = "camelCase")]
@@ -375,4 +379,9 @@ impl Context {
375379
..self
376380
}
377381
}
382+
383+
/// The execution deadline for the current invocation.
384+
pub fn deadline(&self) -> SystemTime {
385+
SystemTime::UNIX_EPOCH + Duration::from_millis(self.deadline)
386+
}
378387
}

0 commit comments

Comments
 (0)