pub struct ModUi {
pub buttons: Vec<UiButton>,
pub popups: BTreeMap<String, UiPopup>,
}Expand description
A mod’s authored launcher-UI schema: which buttons to show for the
mod, and which popups they open. popups is a map keyed by popup id
so buttons can reference popups by name, and validation can catch a
button pointing at a popup that doesn’t exist
(see ModUi::validate).
Fields§
Buttons rendered for this mod, in authored order.
popups: BTreeMap<String, UiPopup>Popups buttons can open, keyed by popup id. May be empty even when buttons exist (e.g. action-only buttons that don’t open a popup).
Implementations§
Source§impl ModUi
impl ModUi
Sourcepub fn validate(&self) -> Result<(), Vec<String>>
pub fn validate(&self) -> Result<(), Vec<String>>
Structural validation of the whole ui section:
- button ids must be unique and non-empty;
- every button’s
actionmust be non-empty; - every button’s
popupreference (if any) must name an entry inModUi::popups, no dangling refs; - a
selectfield must offer at least one option; - unknown popup/field kind strings are rejected (they parse via
the
Unknowncatch-alls precisely so this check can describe them instead of a raw serde error).
§Errors
Returns every problem found (not just the first), matching
crate::mod_config::ModConfig::validate’s collect-everything
convention.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModUi
impl<'de> Deserialize<'de> for ModUi
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ModUi
Auto Trait Implementations§
impl Freeze for ModUi
impl RefUnwindSafe for ModUi
impl Send for ModUi
impl Sync for ModUi
impl Unpin for ModUi
impl UnsafeUnpin for ModUi
impl UnwindSafe for ModUi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more