healthchecks: mark all public methods as #[inline]
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
01c1c91116
commit
5889e4fc9c
|
@ -18,6 +18,7 @@ pub struct HealthcheckConfig {
|
|||
/// Create an instance of [HealthcheckConfig](struct.HealthcheckConfig.html) from a String UUID.
|
||||
/// The method runs basic UUID validation and will panic if there's a failure parsing the provided
|
||||
/// UUID.
|
||||
#[inline]
|
||||
pub fn create_config(uuid: String) -> HealthcheckConfig {
|
||||
if let Ok(_) = Uuid::parse_str(&uuid) {
|
||||
HealthcheckConfig {
|
||||
|
@ -32,6 +33,7 @@ pub fn create_config(uuid: String) -> HealthcheckConfig {
|
|||
/// Create an instance of [HealthcheckConfig](struct.HealthcheckConfig.html) from a String UUID
|
||||
/// and a custom User-Agent header value. Like create_config, this method also runs basic UUID validation
|
||||
/// and panics if the UUID is not valid.
|
||||
#[inline]
|
||||
pub fn create_config_with_user_agent(uuid: String, user_agent: String) -> HealthcheckConfig {
|
||||
if let Ok(_) = Uuid::parse_str(&uuid) {
|
||||
HealthcheckConfig {
|
||||
|
@ -45,6 +47,7 @@ pub fn create_config_with_user_agent(uuid: String, user_agent: String) -> Health
|
|||
|
||||
impl HealthcheckConfig {
|
||||
/// Report success to healthchecks.io. Returns a boolean indicating whether the request succeeded.
|
||||
#[inline]
|
||||
pub fn report_success(&self) -> bool {
|
||||
let res = get(&format!("{}/{}", HEALTHCHECK_PING_URL, self.uuid))
|
||||
.set("User-Agent", &self.user_agent)
|
||||
|
@ -53,6 +56,7 @@ impl HealthcheckConfig {
|
|||
}
|
||||
|
||||
/// Report failure to healthchecks.io. Returns a boolean indicating whether the request succeeded.
|
||||
#[inline]
|
||||
pub fn report_failure(&self) -> bool {
|
||||
let res = get(&format!("{}/{}/fail", HEALTHCHECK_PING_URL, self.uuid))
|
||||
.set("User-Agent", &self.user_agent)
|
||||
|
@ -61,6 +65,7 @@ impl HealthcheckConfig {
|
|||
}
|
||||
|
||||
/// Start a timer on healthchecks.io, to measure script run times. Official documentation for it is available [here](https://healthchecks.io/docs/measuring_script_run_time/).
|
||||
#[inline]
|
||||
pub fn start_timer(&self) -> bool {
|
||||
let res = get(&format!("{}/{}/start", HEALTHCHECK_PING_URL, self.uuid))
|
||||
.set("User-Agent", &self.user_agent)
|
||||
|
|
Loading…
Reference in New Issue