Skip to content

Conversation

@Reisen
Copy link
Contributor

@Reisen Reisen commented Apr 10, 2024

Continuation of #1432 and #1435

@Reisen Reisen requested a review from ali-behjati April 10, 2024 15:35
@vercel
Copy link

vercel bot commented Apr 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Apr 10, 2024 3:35pm
xc-admin-frontend ⬜️ Ignored (Inspect) Apr 10, 2024 3:35pm

Comment on lines +36 to +47
/// Manually implement `Clone` as the derive macro will try and slap `Clone` on
/// `State` which should not be Clone.
impl<S> Clone for ApiState<S> {
fn clone(&self) -> Self {
Self {
state: self.state.clone(),
ws: self.ws.clone(),
metrics: self.metrics.clone(),
update_tx: self.update_tx.clone(),
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm it is strange that clone doesn't work as expected here. Can you explain more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust's Clone derive is a bit basic and will automatically add T: Clone for each generic. I could mark State as Clone as it won't actually get cloned, but that introduces the risk a clone happens elsewhere in the future so opted for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants