https://bytecodealliance.zulipchat.com/#narrow/stream/206238-general/topic/cargo.20component.20param.20vs.20result/near/342360176
I asked a question over in general pertaining to cargo component
, and realized later that this is probably the place for it.
Essentially wondering if it makes sense to add a From
trait to convert between TypeParam
and TypeResult
types in bindings that are generated, so that return types of one wit import can be passed to another
Cow
s were brought up as another solution
^ In particular, unifying *Param
and *Result
by using Cow
s for heap-allocated fields
Another option here would be https://github.com/bytecodealliance/wit-bindgen/issues/535, which I think would be reasonable to turn on by default, which is to always generate APIs with owned types and only optionally generate the *Param
and *Result
structures
I'm not sure that anyone really wants the *Param
and *Result
stuff anyway, it's just how I implemented it originally because I assumed we'd want it for performance but in the end it's so confusing I don't think it's worth it
ah yeah, looks like that would take care of it too
I permit myself to link the topic where I struggle with the same topic https://bytecodealliance.zulipchat.com/#narrow/stream/327223-wit-bindgen/topic/.5Brust.5D.20param.20and.20result.20structs
Actually, it is pretty hard to just give a Vec as a parameter. The Param
works for inlining a parameter, but when you need to give a list of objects, and give it as a parameter... this is a lifetimes hell
Last updated: Dec 23 2024 at 12:05 UTC