#[non_exhaustive]pub struct PanelInstance {
pub id: PanelId,
pub title: Option<String>,
pub payload: Value,
}Expand description
An instance of a panel declared with several (Layout::instances).
use egui_pop_model::ids::PanelId;
use egui_pop_model::layout::{Layout, PanelInstance};
let kind = PanelId::new("app.gallery").unwrap();
let mut layout = Layout::default();
let second = layout.next_instance(&kind);
assert_eq!(second.as_str(), "app.gallery#2");
layout.instances.push(PanelInstance::new(second.clone()).payload(serde_json::json!({ "filter": "red" })));
assert_eq!(layout.next_instance(&kind).as_str(), "app.gallery#3");
assert_eq!(layout.instance(&second).unwrap().payload["filter"], "red");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: PanelIdIts id, <kind>#<n> (the kind alone for instance 1).
title: Option<String>Its title when renamed; its kind’s title and number otherwise.
payload: ValueWhat the application keeps for it (opaque here): handed back as it was saved.
Implementations§
Trait Implementations§
Source§impl Clone for PanelInstance
impl Clone for PanelInstance
Source§fn clone(&self) -> PanelInstance
fn clone(&self) -> PanelInstance
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PanelInstance
impl Debug for PanelInstance
Source§impl<'de> Deserialize<'de> for PanelInstance
impl<'de> Deserialize<'de> for PanelInstance
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
Source§impl PartialEq for PanelInstance
impl PartialEq for PanelInstance
Source§impl Serialize for PanelInstance
impl Serialize for PanelInstance
impl StructuralPartialEq for PanelInstance
Auto Trait Implementations§
impl Freeze for PanelInstance
impl RefUnwindSafe for PanelInstance
impl Send for PanelInstance
impl Sync for PanelInstance
impl Unpin for PanelInstance
impl UnsafeUnpin for PanelInstance
impl UnwindSafe for PanelInstance
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