Skip to content

Better Rust API? #21

@liangjs

Description

@liangjs

As noted in the README, the Rust API is kind of low level. Users need to construct internal structures like CollectingAssemblyEmit and call internal methods sleigh.decode(0).unwrap() (what does this do?) to get the results.
I guess the developer may expect Rust users to be skilled enough, so they can even develop fancier features based on those low level APIs?
How about also providing a higher level one, like shown in the Python/Nodejs bindings?

By the way, the implementation code contains many wrappers of XXXEmit, such as AssemblyEmit, RustAssemblyEmit, CollectingAssemblyEmit, and the Pcode-series emitters. They are basically doing similar things.
I guess the authors may want to provide a callback mechanism and also a default callback that collects the emitted code into a vector. But I think it is kind of over-designed.
Maybe a cleaner way is simply returning an interator, so users can iterate through the generated code and collect them in whatever way they want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions