#unsupported #quick #subset #model #helper #data-model #reduced

serde_serializer_quick_unsupported

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

3 releases

0.1.2 Dec 22, 2022
0.1.1 Oct 21, 2022
0.1.0 Oct 21, 2022

#1557 in Encoding

Download history 1444/week @ 2024-11-18 1132/week @ 2024-11-25 1241/week @ 2024-12-02 602/week @ 2024-12-09 960/week @ 2024-12-16 197/week @ 2024-12-23 141/week @ 2024-12-30 975/week @ 2025-01-06 941/week @ 2025-01-13 701/week @ 2025-01-20 922/week @ 2025-01-27 921/week @ 2025-02-03 832/week @ 2025-02-10 958/week @ 2025-02-17 840/week @ 2025-02-24 1150/week @ 2025-03-03

3,797 downloads per month
Used in 3 crates (2 directly)

LGPL-3.0-only

13KB
270 lines

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

No runtime deps