Skip to main content

ferroui_diagnostics/diagnostics/
dev_tools_data_formats.rs

1//! Port of `Diagnostics/DevToolsDataFormats.cs`.
2
3use ferroui_base::input::{DataFormat, DataFormatOf};
4
5/// Contains data formats related to dev tools.
6pub struct DevToolsDataFormats;
7
8impl DevToolsDataFormats {
9    // TODO (upstream): this name isn't ideal. For instance, it's not a valid UTI for macOS.
10    // We currently have a converter in place in native code for backwards compatibility with IDataObject,
11    // but this should ideally be removed at some point.
12    // Consider using DataFormat.CreateApplicationFormat() instead (breaking change).
13
14    /// Gets the clipboard data format representing a selector.
15    /// It's used for quick format recognition in IDEs.
16    ///
17    /// Deviation (DEVIATIONS.md, Developer tools): the name of the format names the port.
18    pub fn selector() -> DataFormatOf<String> {
19        ferroui_base::ferro_thread_local! {
20            static SELECTOR: DataFormatOf<String> = DataFormat::create_string_platform_format("Ferro_DevTools_Selector");
21        }
22        SELECTOR.with(Clone::clone)
23    }
24}