Comments (2)
There isn't. Here's what lots of my code looks like that uses Storage
to create a thunk:
struct Foo {
data_for_expensive_computation: Data,
expensive: Storage<Expensive>,
}
impl Foo {
fn dont_need_expensive() -> T;
fn do_need_expensive(&self) -> &Expensive {
self.expensive.get_or_set(|| do_expensive(&self.data_for_expensive_computation))
}
}
Here, the "thunk" is really Foo
instead of Storage
as it's what carries the state required to actually force the thunk.
from state.
Looks great, thanks!
from state.
Related Issues (15)
- What happens if two libraries use state? HOT 2
- Compile error after update state v0.3.1 -> v0.3.2 HOT 1
- Thread local state in Container without Send HOT 4
- Latest rust nightly throws error with provided example HOT 2
- It's unclear it is not supposed to work with stable Rust HOT 3
- Container Iterator HOT 4
- Thread-local Container HOT 1
- calls in statics are limited to constant functions, tuple structs and tuple variants HOT 3
- Sample error HOT 7
- no `LocalStorage` in the root HOT 1
- "Unstable library feature" Error while compiling HOT 2
- Examples HOT 3
- Update loom dependency to 0.5 HOT 1
- Provide changelog and update instruction HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from state.