pub struct Scene {
pub prs_version: String,
pub metadata: SceneMetadata,
pub resources: Resources,
pub layout: SceneLayout,
pub widgets: Vec<SceneWidget>,
pub bindings: Vec<Binding>,
pub theme: Option<SceneTheme>,
pub permissions: Permissions,
pub header: Option<HeaderFooter>,
pub footer: Option<HeaderFooter>,
pub key_bindings: Option<KeyBindings>,
}Expand description
Presentar Scene - top-level structure for .prs files.
A Scene is a declarative manifest that references external resources (models, datasets) and defines widget layout and interactions.
Fields§
§prs_version: StringFormat version (semver, e.g., “1.0”)
metadata: SceneMetadataScene metadata
resources: ResourcesExternal resources (models, datasets)
layout: SceneLayoutWidget layout configuration
widgets: Vec<SceneWidget>Widget definitions
bindings: Vec<Binding>Event → action bindings
theme: Option<SceneTheme>Theme configuration
permissions: PermissionsSecurity permissions
header: Option<HeaderFooter>Header bar configuration (for tmux layout)
Footer bar configuration (for tmux layout)
key_bindings: Option<KeyBindings>Keyboard sequence bindings (for tmux layout)
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn from_yaml(yaml: &str) -> Result<Self, SceneError>
pub fn from_yaml(yaml: &str) -> Result<Self, SceneError>
Parse a scene from YAML string.
§Errors
Returns an error if the YAML is invalid or fails validation.
Sourcepub fn validate(&self) -> Result<(), SceneError>
pub fn validate(&self) -> Result<(), SceneError>
Validate the scene structure.
Checks:
- prs_version format (semver)
- metadata.name is kebab-case
- Widget IDs are unique
- Binding targets reference valid widgets/resources
- Remote resources have hashes
- Hash formats are valid (blake3:
)
§Errors
Returns the first validation error found.
Sourcepub fn widget_ids(&self) -> Vec<&str>
pub fn widget_ids(&self) -> Vec<&str>
Get all widget IDs.
Sourcepub fn get_widget(&self, id: &str) -> Option<&SceneWidget>
pub fn get_widget(&self, id: &str) -> Option<&SceneWidget>
Get a widget by ID.
Sourcepub fn get_model(&self, name: &str) -> Option<&ModelResource>
pub fn get_model(&self, name: &str) -> Option<&ModelResource>
Get a model resource by name.
Sourcepub fn get_dataset(&self, name: &str) -> Option<&DatasetResource>
pub fn get_dataset(&self, name: &str) -> Option<&DatasetResource>
Get a dataset resource by name.