You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to serialize or deserialize the Instruction<AllOperands> type from the zydis-rs crate using serde, compilation fails with trait implementation errors. This issue occurs because the Instruction<AllOperands> type does not implement the Serialize and Deserialize traits required by serde.
Steps to Reproduce
Create a new Rust project with serde and zydis-rs as dependencies:
[dependencies]
serde = { version = "1.0.204", features = ["derive"] }
zydis = { version = "4.1.1", features = ["serialization"] }
Use the following minimal code to define a struct with Instruction<AllOperands>:
use serde::{Deserialize,Serialize};use zydis::{AllOperands,Instruction};#[derive(Serialize,Deserialize,Debug)]structNode{name:u64,data:Vec<Instruction<AllOperands>>,}fnmain(){}
Attempt to compile the code:
cargo build
Expected Behavior
The code should compile successfully, and the Node struct should be able to serialize and deserialize Instruction<AllOperands> instances using serde.
Actual Behavior
Compilation fails with the following error messages:
error[E0277]: the trait bound `Instruction<OperandArrayVec<10>>: Serialize` is not satisfied
...
error[E0277]: the trait bound `Instruction<OperandArrayVec<10>>: Deserialize<'_>` is not satisfied
...
Additional Information
The error messages suggest adding #[derive(serde::Serialize)] and #[derive(serde::Deserialize)] to the Instruction<OperandArrayVec<10>> type, but since this type is defined in the zydis-rs crate, it is not possible to directly modify it.
To demonstrate that the issue is specific to Instruction<AllOperands>, here is an example using zydis::ffi::DecodedOperandKind which compiles without issues:
use serde::{Deserialize,Serialize};use zydis::{ffi::DecodedOperandKind,AllOperands,Instruction};#[derive(Serialize,Deserialize,Debug)]structNode{name:u64,data:Vec<DecodedOperandKind>,}fnmain(){}
Suggested Solution
Please add optional Serialize and Deserialize trait implementations for the Instruction<AllOperands> type in the zydis-rs crate
error[E0277]: the trait bound `Instruction<OperandArrayVec<10>>: Serialize` is not satisfied
...
error[E0277]: the trait bound `Instruction<OperandArrayVec<10>>: Deserialize<'_>` is not satisfied
...
We appreciate your attention to this matter and look forward to the inclusion of the necessary serde trait implementations in the zydis-rs crate.
Thank you.
The text was updated successfully, but these errors were encountered:
When trying to serialize or deserialize the
Instruction<AllOperands>
type from thezydis-rs
crate usingserde
, compilation fails with trait implementation errors. This issue occurs because theInstruction<AllOperands>
type does not implement theSerialize
andDeserialize
traits required byserde
.Steps to Reproduce
serde
andzydis-rs
as dependencies:Instruction<AllOperands>
:Expected Behavior
The code should compile successfully, and the
Node
struct should be able to serialize and deserializeInstruction<AllOperands>
instances usingserde
.Actual Behavior
Compilation fails with the following error messages:
Additional Information
The error messages suggest adding
#[derive(serde::Serialize)]
and#[derive(serde::Deserialize)]
to theInstruction<OperandArrayVec<10>>
type, but since this type is defined in thezydis-rs
crate, it is not possible to directly modify it.To demonstrate that the issue is specific to
Instruction<AllOperands>
, here is an example usingzydis::ffi::DecodedOperandKind
which compiles without issues:Suggested Solution
Please add optional
Serialize
andDeserialize
trait implementations for theInstruction<AllOperands>
type in thezydis-rs
crateEnvironment
Relevant Error Logs
We appreciate your attention to this matter and look forward to the inclusion of the necessary
serde
trait implementations in thezydis-rs
crate.Thank you.
The text was updated successfully, but these errors were encountered: