teksilo_core/window/string_id.rs
1// SPDX-License-Identifier: MPL-2.0
2// SPDX-FileCopyrightText: 2026 FernTech
3
4//! Why a window's string id could not be changed; see
5//! [`WindowOps::set_window_string_id`](super::WindowOps::set_window_string_id).
6
7use super::id::TeksiloWindowId;
8
9/// Why [`EventContext::set_window_string_id`](crate::widget::EventContext::set_window_string_id)
10/// left a window's string id as it was.
11#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
12#[non_exhaustive]
13pub enum WindowStringIdError {
14 /// Another open window already has this string id. Two windows with
15 /// one id would leave [`find_window`](super::WindowOps::find_window)
16 /// able to name only one of them, and their saved geometry would be
17 /// one row that both overwrite, so the rename is refused. Close the
18 /// other window, or rename it first.
19 #[error("the window id `{string_id}` is already held by another open window ({holder:?})")]
20 HeldByAnotherWindow {
21 /// The string id that was asked for.
22 string_id: String,
23 /// The open window that has it.
24 holder: TeksiloWindowId,
25 },
26 /// No open window has this id: it was never opened, or it has closed.
27 #[error("no open window has the id {0:?}")]
28 NoSuchWindow(TeksiloWindowId),
29 /// The window operations in use cannot rename a window: a standalone
30 /// tree with no application behind it, or a custom
31 /// [`WindowOps`](super::WindowOps) that does not implement it.
32 #[error("these window operations cannot change a window's string id")]
33 Unsupported,
34}