Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eframe::Frame::info returns a reference #3301

Merged
merged 6 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/eframe/src/epi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ impl Frame {
}

/// Information about the integration.
pub fn info(&self) -> IntegrationInfo {
self.info.clone()
pub fn info(&self) -> &IntegrationInfo {
&self.info
}
Copy link
Owner

Choose a reason for hiding this comment

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

Let's just change the old function to return a reference instead. Users can just call .clone() themselves.


/// A place where you can store custom data in a way that persists when you restart the app.
Expand Down
4 changes: 2 additions & 2 deletions crates/eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ mod glow_integration {
.expect("Single-use AppCreator has unexpectedly already been taken");
let mut app = app_creator(&epi::CreationContext {
egui_ctx: integration.egui_ctx.clone(),
integration_info: integration.frame.info(),
integration_info: integration.frame.info().clone(),
storage: integration.frame.storage(),
gl: Some(gl.clone()),
#[cfg(feature = "wgpu")]
Expand Down Expand Up @@ -1215,7 +1215,7 @@ mod wgpu_integration {
.expect("Single-use AppCreator has unexpectedly already been taken");
let mut app = app_creator(&epi::CreationContext {
egui_ctx: integration.egui_ctx.clone(),
integration_info: integration.frame.info(),
integration_info: integration.frame.info().clone(),
storage: integration.frame.storage(),
#[cfg(feature = "glow")]
gl: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_app/src/backend_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl BackendPanel {
// On web, the browser controls `pixels_per_point`.
let integration_controls_pixels_per_point = frame.is_web();
if !integration_controls_pixels_per_point {
self.pixels_per_point_ui(ui, &frame.info());
self.pixels_per_point_ui(ui, frame.info());
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down