Add ability have a piece of code that gets injected on each compilation.
Discussion
The specific use case is to solve where an external library is relying on kserd to display data, but the papyrus version will be trying to solve using its version of kserd.
A fix can be applied by prefixing the source file with use libname::kserd as kserd and this acts as a drop in replacement for the usual crate kserd (which can be accessed using ::kserd). It requires library developers to expose kserd using pub extern crate kserd in their lib.rs file.
This would solve most use cases, however could fall over when the returning type is coming from a dependency in the REPL and implements ToKserd. This would cause the opposite problem (although have not tested) where the ::kserd is required for resolving.
A possible solution is to add a piece of code which can transform libname::kserd to ::kserd.
Aspects to Develop
[x] Add in edition = "2018" flag to memory code cargo toml
[x] Do test linking in local crate which also implements ToKserd and show that it breaks
[x] Test how to add a transformation from libname::kserd to ::kserd.
[x] Add an optional source prefix which gets added to every source module
[x] Add an optional source prefix which gets added to only lib source module.
Goal
Add ability have a piece of code that gets injected on each compilation.
Discussion
The specific use case is to solve where an external library is relying on
kserd
to display data, but thepapyrus
version will be trying to solve using its version ofkserd
.A fix can be applied by prefixing the source file with
use libname::kserd as kserd
and this acts as a drop in replacement for the usual crate kserd (which can be accessed using::kserd
). It requires library developers to expose kserd usingpub extern crate kserd
in theirlib.rs
file.This would solve most use cases, however could fall over when the returning type is coming from a dependency in the REPL and implements
ToKserd
. This would cause the opposite problem (although have not tested) where the::kserd
is required for resolving.A possible solution is to add a piece of code which can transform
libname::kserd
to::kserd
.Aspects to Develop
edition = "2018"
flag to memory code cargo tomlToKserd
and show that it breakslibname::kserd
to::kserd
.