Skip to content

Commit

Permalink
chore: fix rustfmt error
Browse files Browse the repository at this point in the history
  • Loading branch information
gengteng committed Feb 29, 2024
1 parent f5fdd6a commit 0812074
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ pub mod macros;
#[cfg(feature = "msgpack")]
pub mod msgpack;
pub mod rejection;
#[cfg(feature = "sonic")]
pub mod sonic;
#[cfg(feature = "toml")]
pub mod toml;
#[cfg(feature = "xml")]
pub mod xml;
#[cfg(feature = "yaml")]
pub mod yaml;
#[cfg(feature = "sonic")]
pub mod sonic;

use axum::http::{header, HeaderMap};
use mime::Mime;

#[cfg(feature = "msgpack")]
pub use msgpack::{MsgPack, MsgPackRaw};
pub use rejection::Rejection;
#[cfg(feature = "sonic")]
pub use sonic::Sonic;
#[cfg(feature = "toml")]
pub use toml::Toml;
#[cfg(feature = "xml")]
pub use xml::Xml;
#[cfg(feature = "yaml")]
pub use yaml::Yaml;
#[cfg(feature = "sonic")]
pub use sonic::Sonic;

/// Checks if the content type in the given headers matches the expected content type.
///
Expand Down
7 changes: 4 additions & 3 deletions src/sonic.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! # JSON (Sonic)
//!
use crate::extractor;
use serde::de::{DeserializeOwned, Error as _};
use serde::Serialize;
use sonic_rs::Error;
use crate::extractor;

extractor!(JSON,
extractor!(
JSON,
Sonic,
"application/json",
from_slice,
Expand All @@ -22,4 +23,4 @@ fn from_slice<T: DeserializeOwned>(s: &[u8]) -> Result<T, Error> {
fn to_vec<T: Serialize>(value: &T) -> Result<Vec<u8>, Error> {
let s = sonic_rs::to_string(value)?;
Ok(s.into_bytes())
}
}

0 comments on commit 0812074

Please sign in to comment.