Skip to content

Commit

Permalink
fix: use explicit Result type from std on generated code (#3393)
Browse files Browse the repository at this point in the history
this is done in order to avoid issues that could happen if a different Result type is on scope
  • Loading branch information
morenol committed Jul 13, 2023
1 parent 3aba4f3 commit eaa7761
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/fluvio-protocol-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-protocol-derive"
version = "0.5.2"
version = "0.5.3"
edition = "2021"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Procedure macro to encode/decode fluvio protocol"
Expand Down
2 changes: 1 addition & 1 deletion crates/fluvio-protocol-derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub(crate) fn generate_decode_trait_impls(input: &DeriveItem) -> TokenStream {
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
quote! {
impl #impl_generics fluvio_protocol::Decoder for #ident #ty_generics #where_clause {
fn decode<T>(&mut self, src: &mut T,version: fluvio_protocol::Version) -> Result<(),std::io::Error> where T: fluvio_protocol::bytes::Buf {
fn decode<T>(&mut self, src: &mut T,version: fluvio_protocol::Version) -> ::std::result::Result<(),std::io::Error> where T: fluvio_protocol::bytes::Buf {
// tracing::trace!("decoding struct: {}",stringify!(#ident));
#field_tokens
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/fluvio-protocol-derive/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) fn generate_encode_trait_impls(input: &DeriveItem) -> TokenStream {

quote! {
impl #impl_generics fluvio_protocol::Encoder for #ident #ty_generics #where_clause {
fn encode<T>(&self, dest: &mut T, version: fluvio_protocol::Version) -> Result<(),std::io::Error> where T: fluvio_protocol::bytes::BufMut {
fn encode<T>(&self, dest: &mut T, version: fluvio_protocol::Version) -> ::std::result::Result<(),std::io::Error> where T: fluvio_protocol::bytes::BufMut {
#trace_encode
#encoded_field_tokens
Ok(())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use fluvio_protocol::{Encoder, Decoder};

pub type Result = std::result::Result<(), ()>;

fn main() {}

#[derive(Default, Decoder, Encoder)]
struct PassTupleStruct(String);

0 comments on commit eaa7761

Please sign in to comment.