Coder Social home page Coder Social logo

Comments (3)

peterhuene avatar peterhuene commented on June 24, 2024

Hi @NewGyu, thanks for the question!

This is a convention that comes from the wit-bindgen crate; the only difference is that cargo_component_bindings::generate! puts all of the bindings into a bindings module rather than where the macro is invoked.

Functions that are directly exported from the world are represented with a "top-level" Guest trait (i.e. bindings::Guest).

Interfaces exported from the world go in the bindings::exports module, where each sub-module is for an interface that is exported (e.g. bindings::exports::component::case0::random).

The exports module differentiates from an import of an interface in the world (e.g. bindings::component::case1::random; in that example, it's imported because of the use).

from cargo-component.

NewGyu avatar NewGyu commented on June 24, 2024

Hello @peterhuene, thank you for the detailed explanation. That was very helpful.

from cargo-component.

NewGyu avatar NewGyu commented on June 24, 2024

Functions that are directly exported from the world are represented with a "top-level" Guest trait (i.e. bindings::Guest).

Just my personal opinion, I think the namespace of the Guest trait should be unified to start with bindings::exports:: even if the world exports "top-level" function.

from cargo-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.