Skip to content

Commit 34a8801

Browse files
committed
Cleanup
1 parent 4a09356 commit 34a8801

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

crates/eframe/src/epi.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ pub trait App {
202202
///
203203
/// On web the state is stored to "Local Storage".
204204
///
205-
/// On native the path is picked using [`crate::storage_dir`].
206-
/// The path can be customized via [`NativeOptions::persistence_path`].
205+
/// On native by default the path is picked using [`crate::storage_dir`].
206+
/// The path can be customized via [`NativeOptions::storage_build`].
207207
fn save(&mut self, _storage: &mut dyn Storage) {}
208208

209209
/// Called once on shutdown, after [`Self::save`].
@@ -294,12 +294,15 @@ pub enum HardwareAcceleration {
294294
#[derive(Default, Clone)]
295295
pub enum StorageProvider {
296296
#[default]
297-
/// eframe will use a default
297+
/// `eframe` will use a default
298298
/// data storage path for each target system.
299+
/// The path is picked using [`crate::storage_dir`].
299300
Default,
301+
300302
/// `eframe` will store the app state in the specified file in the ron format.
301303
/// On web builds, this will behave the same as [`Self::Default`].
302304
AtPath(std::path::PathBuf),
305+
303306
/// Custom storage provider.
304307
/// It allows specifying function that will be called during context creation to provide
305308
Custom(fn(&str) -> Option<Box<dyn Storage>>),
@@ -499,7 +502,7 @@ impl Default for NativeOptions {
499502

500503
persist_window: true,
501504

502-
storage_build: StorageProviderBuild::Default,
505+
storage_build: StorageProvider::Default,
503506

504507
dithering: true,
505508

@@ -587,7 +590,7 @@ impl Default for WebOptions {
587590
should_prevent_default: Box::new(|_| true),
588591

589592
max_fps: None,
590-
storage_build: StorageProviderBuild::Default,
593+
storage_build: StorageProvider::Default,
591594
}
592595
}
593596
}

crates/eframe/src/native/epi_integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ impl epi::StorageProvider {
151151
/// Not available on wasm32. For web, use `try_create_storage_web`.
152152
pub fn try_create_storage(&self, app_name: &str) -> Option<Box<dyn epi::Storage>> {
153153
match self {
154-
epi::StorageProviderBuild::Default => create_storage(app_name),
155-
epi::StorageProviderBuild::AtPath(path) => create_storage_with_file(path),
156-
epi::StorageProviderBuild::Custom(f) => f(app_name),
154+
epi::StorageProvider::Default => create_storage(app_name),
155+
epi::StorageProvider::AtPath(path) => create_storage_with_file(path),
156+
epi::StorageProvider::Custom(f) => f(app_name),
157157
}
158158
}
159159
}

crates/eframe/src/web/app_runner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,10 @@ impl epi::StorageProvider {
430430
/// For loading/saving app state and/or egui memory to disk.
431431
pub fn try_create_storage_web(&self, app_name: &str) -> Option<Box<dyn epi::Storage>> {
432432
match self {
433-
epi::StorageProviderBuild::Default | epi::StorageProviderBuild::AtPath(_) => {
433+
epi::StorageProvider::Default | epi::StorageProvider::AtPath(_) => {
434434
Some(Box::new(LocalStorage::default()))
435435
}
436-
epi::StorageProviderBuild::Custom(f) => f(app_name),
436+
epi::StorageProvider::Custom(f) => f(app_name),
437437
}
438438
}
439439
}

examples/custom_storage/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
use std::path::PathBuf;
55

66
use eframe::{
7-
Storage, StorageProviderBuild,
7+
Storage, StorageProvider,
88
egui::{self, ahash::HashMap},
99
};
1010

1111
fn main() -> eframe::Result {
1212
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
1313
let options = eframe::NativeOptions {
1414
viewport: egui::ViewportBuilder::default().with_inner_size([350.0, 590.0]),
15-
storage_build: StorageProviderBuild::Custom(custom_storage),
15+
storage_build: StorageProvider::Custom(custom_storage),
1616
..Default::default()
1717
};
1818
eframe::run_native(

0 commit comments

Comments
 (0)