mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-09 20:11:01 +00:00
Require getters to return the correct type
This commit is contained in:
@@ -8,6 +8,12 @@ use self::content::{SerializeTupleVariantAsMapValue, SerializeStructVariantAsMap
|
||||
#[cfg(feature = "std")]
|
||||
use std::error;
|
||||
|
||||
/// Used to check that serde(getter) attributes return the expected type.
|
||||
/// Not public API.
|
||||
pub fn constrain<T: ?Sized>(t: &T) -> &T {
|
||||
t
|
||||
}
|
||||
|
||||
/// Not public API.
|
||||
pub fn serialize_tagged_newtype<S, T>(serializer: S,
|
||||
type_ident: &'static str,
|
||||
|
||||
Reference in New Issue
Block a user