Add test of remote enum with non_exhaustive

This commit is contained in:
David Tolnay 2023-08-13 21:14:12 -07:00
parent 45271c3676
commit cb490ec16d
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -125,6 +125,9 @@ struct Test {
#[serde(with = "EnumConcrete")]
enum_concrete: remote::EnumGeneric<u8>,
#[serde(with = "ErrorKindDef")]
io_error_kind: std::io::ErrorKind,
}
#[derive(Serialize, Deserialize)]
@ -197,6 +200,15 @@ enum EnumConcrete {
Variant(u8),
}
#[derive(Serialize, Deserialize)]
#[serde(remote = "std::io::ErrorKind")]
#[non_exhaustive]
enum ErrorKindDef {
NotFound,
PermissionDenied,
// ...
}
impl From<PrimitivePrivDef> for remote::PrimitivePriv {
fn from(def: PrimitivePrivDef) -> Self {
remote::PrimitivePriv::new(def.0)