Require getters to return the correct type

This commit is contained in:
David Tolnay
2017-04-09 10:59:54 -07:00
parent a6d172111b
commit 9d8987bde8
3 changed files with 33 additions and 1 deletions
+6
View File
@@ -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,