Replies: 6 comments 10 replies
-
I don't understand, what is your question? Please elaborate. |
Beta Was this translation helpful? Give feedback.
-
Lines 63 to 65 in 4c9edb4 Change |
Beta Was this translation helpful? Give feedback.
-
Swinging over from #1374 I too am confused. I feel like there are a couple ways I would expect
It seems that currently an
|
Beta Was this translation helpful? Give feedback.
-
曝露内部细节相当于引入额外限制,让我们在设计时缚手缚脚。 而要探求
这意味着:
|
Beta Was this translation helpful? Give feedback.
-
Some frameworks define a pub struct Data<T: ?Sized>(Arc<T>);
impl<T> Data<T> {
/// Create new `Data` instance.
pub fn new(state: T) -> Data<T> {
Data(Arc::new(state))
}
} and it impl impl<T: ?Sized> Clone for Data<T> {
fn clone(&self) -> Data<T> {
Data(Arc::clone(&self.0))
}
} so that, when extract, it is like T is not cloned, but Arc is cloned. |
Beta Was this translation helpful? Give feedback.
-
This seems to have been resolved in 0.6.0-rc3 by #1460. |
Beta Was this translation helpful? Give feedback.
-
The state is usually used for data sharing. It can be a db connection, cache client, HTTP client, or a couple of them, which is always wrapped in
Arc
.Beta Was this translation helpful? Give feedback.
All reactions