urlyy commented on PR #2898:
URL: https://github.com/apache/fory/pull/2898#issuecomment-3536836306

   1. Currently, ForyRust requires users to use `#[fory(compress_int)]` or 
`#[fory(compress_int=true/false)]` on a type to set whether `compress_int` is 
enabled for that type. ForyRust will directly compute the `version_hash` at 
compile time based on the type’s corresponding `compress_int`.
   
   2. If the parameter macro is not used, `compress_int` defaults to `true`.
   
   3. When registering, ForyRust sets the `TypeResolver`’s `compress_int` value 
based on the `is_compress_int()` return value of the registered type. 
Therefore, if there is a conflict, it will panic immediately. This requires 
that all types registered under a single Fory object must have the same 
`compress_int` value.
   
   4. As mentioned above, I added a new method `is_compress_int()` to 
`StructSerializer`.
   
   5. If no type has been registered yet, users can manually set 
`compress_int()` by calling `fory.compress_int(bool)`. However, if a type with 
`compress_int=true/false` has already been registered, setting 
`fory.compress_int(false/true)` will immediately panic.
   
   6. For `EXT`, there’s no need to worry. If some struct types are already 
registered, `EXT`’s `compress_int` will match the other registered types. If 
not, it can still be manually set via `fory.compress_int(bool)`.
   
   7. Since the default value of `compress_int` is `true`, it can be cumbersome 
for users who want to set it to `false` for everything. Therefore, I submitted 
#2916 to help alleviate this situation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to