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 don't really know how to go about this, so I've come here (since I figure you all might have more understanding). Essentially what I want is to create a factory of every type that a function is called for (essentially every monomorphization).
The following is roughly my code:
fndo_something_with<T>(t:T){#[ctor::ctor]fnregister(){register_factory::<T>();}// Do something with t
...}fnregister_factory<T>(){// Put T in a HashMap after making a factory type.
...}
Unfortunately, I can't do this because the register function can't refer to T, due to rustc --explain E0401 (inner fns do not inherit type or const parameters from functions they are embedded in).
I'm not sure if this is even possible, or maybe there's a way to extend ctor to allow calling generic functions?
The text was updated successfully, but these errors were encountered:
I don't really know how to go about this, so I've come here (since I figure you all might have more understanding). Essentially what I want is to create a factory of every type that a function is called for (essentially every monomorphization).
The following is roughly my code:
Unfortunately, I can't do this because the
register
function can't refer toT
, due torustc --explain E0401
(inner fns do not inherit type or const parameters from functions they are embedded in).I'm not sure if this is even possible, or maybe there's a way to extend ctor to allow calling generic functions?
The text was updated successfully, but these errors were encountered: