Skip to content

Commit

Permalink
try fxi
Browse files Browse the repository at this point in the history
  • Loading branch information
larziwau authored Nov 28, 2024
1 parent e3eb402 commit e981178
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn derive_encodable(input: TokenStream) -> TokenStream {
let struct_name = &input.ident;
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();

let gen = match &input.data {
let otherGen = match &input.data {
Data::Struct(data) if let Some(bit_attrs) = bit_attrs => {
encode::for_bit_struct(data, bit_attrs, struct_name, &impl_generics, &ty_generics, where_clause)
}
Expand All @@ -39,7 +39,7 @@ pub fn derive_encodable(input: TokenStream) -> TokenStream {
}
};

gen.into()
otherGen.into()
}

/// Implements `Decodable` for the given type, allowing you to deserialize it from a `ByteReader`/`ByteBuffer`.
Expand All @@ -54,7 +54,7 @@ pub fn derive_decodable(input: TokenStream) -> TokenStream {

let struct_name = &input.ident;

let gen = match &input.data {
let otherGen = match &input.data {
Data::Struct(data) if let Some(bit_attrs) = bit_attrs => decode::for_bit_struct(data, bit_attrs, struct_name),
Data::Struct(data) => decode::for_struct(data, struct_name),
Data::Enum(data) => decode::for_enum(data, struct_name, &get_enum_repr_type(&input)),
Expand All @@ -66,7 +66,7 @@ pub fn derive_decodable(input: TokenStream) -> TokenStream {
}
};

gen.into()
otherGen.into()
}

/// Implements `StaticSize` for the given type, allowing you to compute the encoded size of the value at compile time.
Expand Down Expand Up @@ -111,14 +111,14 @@ pub fn derive_static_size(input: TokenStream) -> TokenStream {
}
};

let gen = quote! {
let otherGen = quote! {
impl StaticSize for #struct_name {
const ENCODED_SIZE: usize = #encoded_size;
}
};

// Return the generated implementation as a TokenStream
gen.into()
otherGen.into()
}

/// Implements `DynamicSize` for the given type, allowing you to compute the encoded size of the value at runtime.
Expand Down Expand Up @@ -190,7 +190,7 @@ pub fn derive_dynamic_size(input: TokenStream) -> TokenStream {
}
};

let gen = quote! {
let otherGen = quote! {
impl #impl_generics DynamicSize for #struct_name #ty_generics #where_clause {
#[inline]
fn encoded_size(&self) -> usize {
Expand All @@ -200,7 +200,7 @@ pub fn derive_dynamic_size(input: TokenStream) -> TokenStream {
};

// Return the generated implementation as a TokenStream
gen.into()
otherGen.into()
}

/// Implements `Packet`, `PacketMetadata` and the function `const fn header() -> PacketHeader` for the given struct.
Expand Down

0 comments on commit e981178

Please sign in to comment.