pub struct ResponseSnapshot {
pub status: u16,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
pub elapsed: Option<Duration>,
}Fields§
§status: u16§headers: Vec<(String, String)>§body: Vec<u8>§elapsed: Option<Duration>Implementations§
Source§impl ResponseSnapshot
impl ResponseSnapshot
Sourcepub fn new(
status: u16,
headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
body: impl Into<Vec<u8>>,
) -> Self
pub fn new( status: u16, headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, body: impl Into<Vec<u8>>, ) -> Self
Examples found in repository?
examples/basic_diff.rs (line 5)
4fn main() {
5 let baseline = ResponseSnapshot::new(200, vec![("Server", "nginx")], "hello world")
6 .with_elapsed(Duration::from_millis(80));
7 let probe = ResponseSnapshot::new(
8 500,
9 vec![("Server", "envoy"), ("X-Blocked", "1")],
10 "request blocked",
11 )
12 .with_elapsed(Duration::from_millis(240));
13
14 let diff = compare_responses(baseline, probe);
15 println!("status_changed={}", diff.status_changed);
16 println!("significant={}", is_differential_match(&diff));
17}Sourcepub fn with_elapsed(self, elapsed: Duration) -> Self
pub fn with_elapsed(self, elapsed: Duration) -> Self
Examples found in repository?
examples/basic_diff.rs (line 6)
4fn main() {
5 let baseline = ResponseSnapshot::new(200, vec![("Server", "nginx")], "hello world")
6 .with_elapsed(Duration::from_millis(80));
7 let probe = ResponseSnapshot::new(
8 500,
9 vec![("Server", "envoy"), ("X-Blocked", "1")],
10 "request blocked",
11 )
12 .with_elapsed(Duration::from_millis(240));
13
14 let diff = compare_responses(baseline, probe);
15 println!("status_changed={}", diff.status_changed);
16 println!("significant={}", is_differential_match(&diff));
17}pub fn body_text(&self) -> String
Trait Implementations§
Source§impl Clone for ResponseSnapshot
impl Clone for ResponseSnapshot
Source§fn clone(&self) -> ResponseSnapshot
fn clone(&self) -> ResponseSnapshot
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResponseSnapshot
impl Debug for ResponseSnapshot
Source§impl<'de> Deserialize<'de> for ResponseSnapshot
impl<'de> Deserialize<'de> for ResponseSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoResponseSnapshot for &ResponseSnapshot
impl IntoResponseSnapshot for &ResponseSnapshot
fn into_snapshot(self) -> ResponseSnapshot
Source§impl IntoResponseSnapshot for ResponseSnapshot
impl IntoResponseSnapshot for ResponseSnapshot
fn into_snapshot(self) -> ResponseSnapshot
Source§impl PartialEq for ResponseSnapshot
impl PartialEq for ResponseSnapshot
Source§impl Serialize for ResponseSnapshot
impl Serialize for ResponseSnapshot
impl Eq for ResponseSnapshot
impl StructuralPartialEq for ResponseSnapshot
Auto Trait Implementations§
impl Freeze for ResponseSnapshot
impl RefUnwindSafe for ResponseSnapshot
impl Send for ResponseSnapshot
impl Sync for ResponseSnapshot
impl Unpin for ResponseSnapshot
impl UnsafeUnpin for ResponseSnapshot
impl UnwindSafe for ResponseSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more