Skip to content

Commit

Permalink
Bump simd-json to 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrasnitski committed Nov 20, 2023
1 parent 45e2599 commit a337704
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ version = "1.0.7"
optional = true

[dependencies.simd-json]
version = "0.4.14"
version = "0.12.0"
optional = true

[dependencies.tracing]
Expand Down
12 changes: 5 additions & 7 deletions src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use std::collections::HashMap;
use std::hash::{BuildHasher, Hash};

#[cfg(feature = "gateway")]
use serde::de::Deserialize;
use serde::de::DeserializeOwned;
use serde::ser::Serialize;

Expand Down Expand Up @@ -62,19 +60,19 @@ where
}

#[cfg(all(feature = "gateway", not(feature = "simd_json")))]
pub(crate) fn from_str<'a, T>(s: &'a mut str) -> Result<T>
pub(crate) fn from_str<'a, T>(s: &'a str) -> Result<T>
where
T: Deserialize<'a>,
T: serde::de::Deserialize<'a>,
{
Ok(serde_json::from_str(s)?)
}

#[cfg(all(feature = "gateway", feature = "simd_json"))]
pub(crate) fn from_str<'a, T>(s: &'a mut str) -> Result<T>
pub(crate) fn from_str<T>(s: &str) -> Result<T>
where
T: Deserialize<'a>,
T: DeserializeOwned,
{
Ok(simd_json::from_str(s)?)
Ok(simd_json::from_slice(&mut s.to_owned().into_bytes())?)
}

#[cfg(not(feature = "simd_json"))]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::model::id::UserId;
/// Validate that a token is valid and that a number of malformed tokens are
/// actually invalid:
///
/// ```
/// ```rust,no_run
/// use serenity::utils::token::validate;
///
/// // ensure a valid token is in fact a valid format:
Expand Down

0 comments on commit a337704

Please sign in to comment.