mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 04:48:01 +00:00
add attribute try_from
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(from = "u64", try_from = "u64")]
|
||||
struct S {
|
||||
a: u8,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: #[serde(from = "...")] and #[serde(try_from = "...")] conflict with each other
|
||||
--> $DIR/from-try-from.rs:4:1
|
||||
|
|
||||
4 | / #[serde(from = "u64", try_from = "u64")]
|
||||
5 | | struct S {
|
||||
6 | | a: u8,
|
||||
7 | | }
|
||||
| |_^
|
||||
Reference in New Issue
Block a user