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
I think this gives us some options to store extra data related to native functionality without need several new types to values. The example in mind is the beginnings of the regexp module. Here I'm primarily just wrapping the regex crate. For each of the three test methods I have test, match and captures I have currently construct a new Regex struct each time this is invoked which is quite wasteful. Instead I could make a new trait ManagedAny something like
traitManagedAny:Manage + any::Any{}
This way I can store essentially arbitrary extra data on an instance such as a Regex struct and implement the normal Manage members. Inside methods on my Regexp class I should be able to call.
let instance = this.unwrap().to_instance();let regex = match instance.native_data.downcast_ref::<Regex>().expect("Expected Regex")// use regex
The text was updated successfully, but these errors were encountered:
I'm thinking there may be some benefit to adding some generic fields to the
Instance
struct. Something likeI think this gives us some options to store extra data related to native functionality without need several new types to values. The example in mind is the beginnings of the
regexp
module. Here I'm primarily just wrapping theregex
crate. For each of the three test methods I havetest
,match
andcaptures
I have currently construct a newRegex
struct each time this is invoked which is quite wasteful. Instead I could make a new traitManagedAny
something likeThis way I can store essentially arbitrary extra data on an instance such as a
Regex
struct and implement the normalManage
members. Inside methods on myRegexp
class I should be able to call.The text was updated successfully, but these errors were encountered: