I am building a Lambda function in Rust via crowbar. One thing I would like to be able to do is for each invocation, associate data with the current thread so as to be accessible from method along my chain of calls. A problem I see is that if I use Rayon and the
thread_localcrate, I imagine that my ThreadLocal instance won’t follow down into child threads. Is there a generally accepted way to work around this?
Specifically, I would like to associate the Lambda request ID supplied by the context as well as a
tokio_core::reactor::Core and a
rusoto_credential::InstanceMetadataProvider to all execution paths.
If I use Rayon, I imagine that these values will not be copied over into the new child threads. Any ideas?