Mossaka / client-node

3 stars 1 forks source link

Implement a trait to convert rust to js types and deprecate `CommonTypes` #16

Closed Mossaka closed 3 years ago

Mossaka commented 3 years ago

Per discussion with @andylokandy, the CommonTypes enum implementation looks strange and should be deprecated by a trait implementation.

A proposed solution looks like this:

trait ToJS {
    fn to_js_value(&mut self, cx: FunctionContext) -> Handle<JsValue>;
}
impl ToJS for Vec<Key> {
    pub fn to_js_value(&mut self, cx: FunctionContext) -> Handle<JsValue> { todo!() }
}