Skip to main content

ferroui_diagnostics/diagnostics/
conventions.rs

1//! Port of `Diagnostics/Conventions.cs`.
2
3use super::screenshots::FilePickerHandler;
4use super::IScreenshotHandler;
5use std::rc::Rc;
6
7/// The defaults of DevTools.
8pub struct Conventions;
9
10impl Conventions {
11    /// The screenshot handler of [`DevToolsOptions`](super::DevToolsOptions) by default: one
12    /// [`FilePickerHandler`] (per thread; the objects of the port are not shared between threads).
13    pub fn default_screenshot_handler() -> Rc<dyn IScreenshotHandler> {
14        ferroui_base::ferro_thread_local! {
15            static DEFAULT_SCREENSHOT_HANDLER: Rc<dyn IScreenshotHandler> = Rc::new(FilePickerHandler::new());
16        }
17        DEFAULT_SCREENSHOT_HANDLER.with(Rc::clone)
18    }
19}