Skip to content

Commit

Permalink
simplify rust decode headers code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ousret committed Dec 28, 2024
1 parent 9eaef26 commit b6a695f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use httlib_hpack::{Decoder as InternalDecoder, Encoder as InternalEncoder};
use pyo3::exceptions::PyException;
use pyo3::types::{PyBool, PyList, PyString, PyTuple};
use pyo3::{prelude::*, pymethods, types::PyBytes};
use pyo3::types::{PyList, PyTuple};
use pyo3::{prelude::*, types::PyBytes};

pyo3::create_exception!(_hazmat, HPACKError, PyException);
pyo3::create_exception!(_hazmat, OversizedHeaderListError, PyException);
Expand Down Expand Up @@ -188,9 +188,9 @@ impl Decoder {
PyTuple::new(
py,
[
PyBytes::new(py, &name).to_object(py),
PyBytes::new(py, &value).to_object(py),
PyBool::new(py, is_sensitive).to_object(py),
name.to_object(py),
value.to_object(py),
is_sensitive.to_object(py),
],
)
.unwrap(),
Expand All @@ -200,9 +200,9 @@ impl Decoder {
PyTuple::new(
py,
[
PyString::new(py, std::str::from_utf8(&name)?).to_object(py),
PyString::new(py, std::str::from_utf8(&value)?).to_object(py),
PyBool::new(py, is_sensitive).to_object(py),
std::str::from_utf8(&name)?.to_object(py),
std::str::from_utf8(&value)?.to_object(py),
is_sensitive.to_object(py),
],
)
.unwrap(),
Expand Down

0 comments on commit b6a695f

Please sign in to comment.