Skip to content

Commit 3b71f8d

Browse files
author
Peter Sebastian Puetz
committed
Impl Debug + Display for Scheme
1 parent d2e38e7 commit 3b71f8d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/client.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ use crate::response::*;
66
use crate::selector::Selector;
77
use crate::util::{validate_duration, RuleType, TargetState};
88
use std::collections::HashMap;
9+
use std::fmt;
910
use url::Url;
1011

1112
/// A helper enum that is passed to the [Client::new] function in
1213
/// order to avoid errors on unsupported connection schemes.
14+
#[derive(Debug)]
1315
pub enum Scheme {
1416
Http,
1517
Https,
@@ -24,6 +26,15 @@ impl Scheme {
2426
}
2527
}
2628

29+
impl fmt::Display for Scheme {
30+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31+
match self {
32+
Self::Http => write!(f, "http"),
33+
Self::Https => write!(f, "https"),
34+
}
35+
}
36+
}
37+
2738
/// A client used to execute queries. It uses a [reqwest::Client] internally
2839
/// that manages connections for us.
2940
#[derive(Clone)]

0 commit comments

Comments
 (0)