link:Cargo.toml[]
link:src/lib.rs[]
Utility for setting scope-limited "environmental values" can can be accessed statically.
License: Apache License 2.0
for now, environmental can like this:
environmental!(counter: u32);
but I wanna use environmental
like this:
struct A<C:Config> {
//...
}
environmental!(counter: A<C: Config>);
thus the environmental!
need to support rust generic.
Can you guys support this? Thanks!
Hey, I'm trying to import and use the environmental crate on a substrate chain, but it will not allow me to enable feature flags(?)
[dependencies]
environmental = { version = "1.1.3", features=["std"], git = "https://github.com/paritytech/environmental/" }
//#[macro_use] //extern crate environmental;
environmental::environmental!(listener: dyn Listener + 'static);
pub fn using<R, F: FnOnce() -> R>(l: &mut (dyn Listener + 'static), f: F) -> R {
listener::using(l, f)
}
That throws me an error:
error: cannot find macro `thread_local` in this scope
--> /home/runner/work/edgeware-node/edgeware-node/primitives/rpc/evm-tracing-events/src/lib.rs:53:1
|
53 | environmental::environmental!(listener: dyn Listener + 'static);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `thread_local` is in scope, but it is an attribute: `#[thread_local]`
= note: this error originates in the macro `$crate::thread_local_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find value `GLOBAL` in this scope
--> /home/runner/work/edgeware-node/edgeware-node/primitives/rpc/evm-tracing-events/src/lib.rs:53:1
|
53 | environmental::environmental!(listener: dyn Listener + 'static);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: this error originates in the macro `environmental::environmental` (in Nightly builds, run with -Z macro-backtrace for more info)
Detailed debug log:
https://github.com/edgeware-network/edgeware-node/runs/6611632907?check_suite_focus=true#step:8:1494
When running benchmarks, we are getting the following error, and we have problems finding the issue, we never had any problems under normal load. The potential causes coming to my mind is a potentially deep nesting of with
calls due to access from different threads. This is how we use it: https://github.com/integritee-network/sgx-runtime/blob/7249cad5f43f73f2fc8f676a6a2435f057962b73/substrate-sgx/sp-io/src/lib.rs#L109
thread '' panicked at 'already borrowed: BorrowMutError', /home/sproll/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.3/src/lib.rs:142:41
note: Call backtrace::enable_backtrace with 'PrintFormat::Short/Full' for a backtrace.
fatal runtime error: failed to initiate panic, error 5
Do you have any idea, what it could be?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.