mirror of https://git.sr.ht/~stygianentity/bincode
Generate qualified Result type in derive (#430)
This commit is contained in:
parent
e54a47cf14
commit
7174f6422d
|
|
@ -97,7 +97,7 @@ impl DeriveEnum {
|
|||
.generate_fn("borrow_decode")
|
||||
.with_generic("D", ["bincode::de::BorrowDecoder<'__de>"])
|
||||
.with_arg("mut decoder", "D")
|
||||
.with_return_type("Result<Self, bincode::error::DecodeError>")
|
||||
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
|
||||
.body(|fn_builder| {
|
||||
fn_builder
|
||||
.push_parsed("let variant_index = <u32 as bincode::de::Decode>::decode(&mut decoder)?;").unwrap();
|
||||
|
|
@ -147,7 +147,7 @@ impl DeriveEnum {
|
|||
.generate_fn("decode")
|
||||
.with_generic("D", ["bincode::de::Decoder"])
|
||||
.with_arg("mut decoder", "D")
|
||||
.with_return_type("Result<Self, bincode::error::DecodeError>")
|
||||
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
|
||||
.body(|fn_builder| {
|
||||
fn_builder
|
||||
.push_parsed("let variant_index = <u32 as bincode::de::Decode>::decode(&mut decoder)?;").unwrap();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl DeriveStruct {
|
|||
.with_generic("E", ["bincode::enc::Encoder"])
|
||||
.with_self_arg(crate::generate::FnSelfArg::RefSelf)
|
||||
.with_arg("mut encoder", "E")
|
||||
.with_return_type("Result<(), bincode::error::EncodeError>")
|
||||
.with_return_type("core::result::Result<(), bincode::error::EncodeError>")
|
||||
.body(|fn_body| {
|
||||
for field in fields.names() {
|
||||
fn_body
|
||||
|
|
@ -47,7 +47,7 @@ impl DeriveStruct {
|
|||
.generate_fn("borrow_decode")
|
||||
.with_generic("D", ["bincode::de::BorrowDecoder<'__de>"])
|
||||
.with_arg("mut decoder", "D")
|
||||
.with_return_type("Result<Self, bincode::error::DecodeError>")
|
||||
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
|
||||
.body(|fn_body| {
|
||||
// Ok(Self {
|
||||
fn_body.ident_str("Ok");
|
||||
|
|
@ -77,7 +77,7 @@ impl DeriveStruct {
|
|||
.generate_fn("decode")
|
||||
.with_generic("D", ["bincode::de::Decoder"])
|
||||
.with_arg("mut decoder", "D")
|
||||
.with_return_type("Result<Self, bincode::error::DecodeError>")
|
||||
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
|
||||
.body(|fn_body| {
|
||||
// Ok(Self {
|
||||
fn_body.ident_str("Ok");
|
||||
|
|
|
|||
Loading…
Reference in New Issue