Expand description
Typed ids (ADR 0002): one newtype per namespace, sharing one syntax, serialized as plain strings.
use egui_pop_model::ids::{CommandId, ZoneId};
const SIDEBAR: ZoneId = ZoneId::from_static("app.sidebar");
let palette = CommandId::new("view.palette").unwrap();
assert_eq!(palette.as_str(), "view.palette");
assert_eq!(serde_json::to_string(&SIDEBAR).unwrap(), "\"app.sidebar\"");
assert!(CommandId::new("has space").is_err());An invalid literal in from_static is a compile error when used in a
constant:
ⓘ
use egui_pop_model::ids::ZoneId;
const BAD: ZoneId = ZoneId::from_static("no spaces allowed");Structs§
- BlockId
- A block in a zone.
- Command
Id - A command:
view.palette,file.save. - FrameId
- A frame of the context stack (ADR 0012): a place (
demo.album) or a mode (demo.orientation.culling). - GroupId
- A group of modes, one active at a time (
orientation): the context keymode.<group>, so letters, digits,_and.. - HookId
- A hook point declarations are altered at.
- IdError
- Why a text is not an id.
- MenuId
- A menu:
app.main,panel.tab. - OwnerId
- Who registered something: a plugin’s id,
framework,user. - PanelId
- A panel:
app.log; an instance of a panel declared with several (PanelSpec::instances) adds#<n>:app.gallery#2. - Plugin
Id - A plugin:
gallery.overview. - ScopeId
- A history (ADR 0014): one undo line, a document’s edit, a
collection’s marks, the settings window (
app,settings). - Service
Id - A service plugins share.
- Setting
Id - A setting, also its path in the value store under
settings/. - StepId
- A step of a feature’s life that plugins may watch, veto, replace
or extend:
frame.close,workbench.detach. - StoryId
- A gallery story.
- ZoneId
- A zone where blocks are drawn:
app.sidebar.
Constants§
- MAX_
ID_ LEN - The longest id, in bytes.
- SETTINGS_
PREFIX - Where settings live in the value store: a setting
idis atsettings/<id>(SettingId::path).
Functions§
- check
- Checks the shared syntax: ASCII letters, digits and
. _ - / :, not empty, at mostMAX_ID_LENbytes.Errholds the reason. - check_
panel - Checks a panel id: the shared syntax (
check), and an instance’s#<n>after it (app.gallery#2, ADR 0002’s panel instances),na number from 2 without leading zeros (the panel declared is instance 1).