serde_serializer_quick_unsupported

Crates.ioserde_serializer_quick_unsupported
lib.rsserde_serializer_quick_unsupported
version0.1.2
sourcesrc
created_at2022-10-21 09:45:51.312768
updated_at2022-12-22 22:38:07.91412
descriptionHelper for implementing a serializer that supports a reduced subset of the serde data model
homepage
repositoryhttps://github.com/Ten0/vec_storage_reuse
max_upload_size
id693376
size20,157
Thomas B (Ten0)

documentation

README

serde_serializer_quick_unsupported

Crates.io License

Helper for implementing a serializer that supports a reduced subset of the serde data model

Often times you need to implement a serializer where a bunch of input types are unexpected/unsupported This convenience macro allows you to declare those more easily:

use serde_serializer_quick_unsupported::serializer_unsupported;

struct MySerializer;
impl serde::Serializer for MySerializer {
	type Ok = ();
	type Error = serde::de::value::Error;
	serializer_unsupported! {
		err = (<Self::Error as serde::ser::Error>::custom("Unexpected input"));
		bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str bytes none some unit unit_struct
		unit_variant newtype_struct newtype_variant seq tuple tuple_struct tuple_variant map struct
		struct_variant i128 u128
	}
}

Just remove the stuff you want to not error

Commit count: 6

cargo fmt