mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-27 01:37:42 +02:00
add static assertions to bytestring
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
#![no_std]
|
||||
#![deny(rust_2018_idioms, nonstandard_style)]
|
||||
#![warn(missing_docs)]
|
||||
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
|
||||
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
||||
|
||||
@ -217,17 +218,36 @@ mod serde {
|
||||
String::deserialize(deserializer).map(ByteString::from)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod serde_impl_tests {
|
||||
use super::*;
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use static_assertions::assert_impl_all;
|
||||
|
||||
assert_impl_all!(ByteString: Serialize, DeserializeOwned);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use alloc::borrow::ToOwned;
|
||||
use core::hash::{Hash, Hasher};
|
||||
use core::{
|
||||
hash::{Hash, Hasher},
|
||||
panic::{RefUnwindSafe, UnwindSafe},
|
||||
};
|
||||
|
||||
use ahash::AHasher;
|
||||
use static_assertions::assert_impl_all;
|
||||
|
||||
use super::*;
|
||||
|
||||
assert_impl_all!(ByteString: Send, Sync, Unpin, Sized);
|
||||
assert_impl_all!(ByteString: UnwindSafe, RefUnwindSafe);
|
||||
assert_impl_all!(ByteString: Clone, Default, Eq, PartialOrd, Ord);
|
||||
assert_impl_all!(ByteString: fmt::Debug, fmt::Display);
|
||||
|
||||
#[test]
|
||||
fn test_partial_eq() {
|
||||
let s: ByteString = ByteString::from_static("test");
|
||||
|
Reference in New Issue
Block a user