Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSRV 1.61 #714

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ jobs:
with:
command: doc
args: --no-deps --all-features --document-private-items

build_versions:
strategy:
matrix:
rust: [stable, beta, 1.61.0]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: build
- uses: actions-rs/cargo@v1
with:
command: build

build_and_test:
name: Test
runs-on: ubuntu-latest
Expand Down
118 changes: 43 additions & 75 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ http-02 = { package = "http", version = "0.2", optional = true }
http = { version = "1.0", optional = true }

# This can't be in dev-dependencies due to doc tests.
hootbin = { version = "0.1.0" }
hootbin = { version = "0.1.1" }

[dev-dependencies]
serde = { version = "1", features = ["derive"] }
env_logger = "0.11.1"
env_logger = "<=0.9"
rustls = { version = "0.22.0" }
rustls-pemfile = { version = "2.0" }

Expand Down
10 changes: 5 additions & 5 deletions src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,34 +152,34 @@ impl Header {
}

/// For non-utf8 headers this returns [`None`] (use [`get_header_raw()`]).
pub fn get_header<'h>(headers: &'h [Header], name: &str) -> Option<&'h str> {
pub(crate) fn get_header<'h>(headers: &'h [Header], name: &str) -> Option<&'h str> {
headers
.iter()
.find(|h| h.is_name(name))
.and_then(|h| h.value())
}

#[allow(unused)]
pub fn get_header_raw<'h>(headers: &'h [Header], name: &str) -> Option<&'h [u8]> {
pub(crate) fn get_header_raw<'h>(headers: &'h [Header], name: &str) -> Option<&'h [u8]> {
headers
.iter()
.find(|h| h.is_name(name))
.map(|h| h.value_raw())
}

pub fn get_all_headers<'h>(headers: &'h [Header], name: &str) -> Vec<&'h str> {
pub(crate) fn get_all_headers<'h>(headers: &'h [Header], name: &str) -> Vec<&'h str> {
headers
.iter()
.filter(|h| h.is_name(name))
.filter_map(|h| h.value())
.collect()
}

pub fn has_header(headers: &[Header], name: &str) -> bool {
pub(crate) fn has_header(headers: &[Header], name: &str) -> bool {
get_header(headers, name).is_some()
}

pub fn add_header(headers: &mut Vec<Header>, header: Header) {
pub(crate) fn add_header(headers: &mut Vec<Header>, header: Header) {
let name = header.name();
if !name.starts_with("x-") && !name.starts_with("X-") {
headers.retain(|h| h.name() != name);
Expand Down
Loading