Skip to content

Commit

Permalink
add not(test) configure to some structs
Browse files Browse the repository at this point in the history
  • Loading branch information
yaa110 committed Jul 1, 2020
1 parent d128c6e commit 91d18b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::marker::PhantomData;
use std::ptr::copy_nonoverlapping;
use std::{slice, str};

#[cfg(not(test))]
pub struct Header(*const ngx_table_elt_t);

impl ngx_str_t {
Expand All @@ -28,11 +29,13 @@ impl ngx_http_headers_in_t {
unsafe { (*self.host).value.to_str() }
}

#[cfg(not(test))]
pub fn to_iterator(&self) -> ListIterator<'_> {
ListIterator::from_ngx_list(&self.headers)
}
}

#[cfg(not(test))]
pub struct ListIterator<'a> {
done: bool,
part: *const ngx_list_part_t,
Expand Down Expand Up @@ -84,6 +87,7 @@ impl From<*const ngx_table_elt_t> for Header {
}

impl Header {
#[cfg(not(test))]
pub fn new(req: &mut ngx_http_request_t) -> Option<Self> {
let table: *const ngx_table_elt_t =
unsafe { ngx_list_push(&mut req.headers_in.headers) as *const _ };
Expand Down

0 comments on commit 91d18b3

Please sign in to comment.