pub struct SurfaceSpec {
pub surface_id: String,
pub catalog_id: String,
pub components: Vec<Component>,
pub data_model: Option<Value>,
pub data_path: String,
pub theme: Option<Value>,
pub send_data_model: Option<bool>,
}Expand description
What a surface should look like, as the authoring layer sees it.
Fields§
§surface_id: StringTarget surface id. Defaults to DEFAULT_SURFACE_ID.
catalog_id: StringCatalog the components are drawn from. Defaults to BASIC_CATALOG_ID.
components: Vec<Component>The flat component adjacency list.
data_model: Option<Value>Initial or updated data model. None sends no data operation.
data_path: StringWhere the data model is written.
Defaults to /, which replaces the whole model. When updating a live
surface, prefer a narrower pointer: the renderer’s two-way bindings write
user input straight into this model, and replacing the root discards it.
theme: Option<Value>Optional catalog-defined theme for createSurface.
send_data_model: Option<bool>Ask the renderer to echo the data model back with every message.
Implementations§
Source§impl SurfaceSpec
impl SurfaceSpec
Sourcepub fn new(surface_id: impl Into<String>) -> Self
pub fn new(surface_id: impl Into<String>) -> Self
A spec for the given surface with default catalog and no content.
Sourcepub fn with_components(self, components: Vec<Component>) -> Self
pub fn with_components(self, components: Vec<Component>) -> Self
Sets the component list.
Sourcepub fn with_data_model(self, data_model: Value) -> Self
pub fn with_data_model(self, data_model: Value) -> Self
Sets the data model, written at SurfaceSpec::data_path.
Sourcepub fn with_catalog_id(self, catalog_id: impl Into<String>) -> Self
pub fn with_catalog_id(self, catalog_id: impl Into<String>) -> Self
Sets the catalog id.
Sourcepub fn with_data_path(self, data_path: impl Into<String>) -> Self
pub fn with_data_path(self, data_path: impl Into<String>) -> Self
Sets the pointer the data model is written at.
Trait Implementations§
Source§impl Clone for SurfaceSpec
impl Clone for SurfaceSpec
Source§fn clone(&self) -> SurfaceSpec
fn clone(&self) -> SurfaceSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SurfaceSpec
impl Debug for SurfaceSpec
Source§impl Default for SurfaceSpec
impl Default for SurfaceSpec
Source§impl PartialEq for SurfaceSpec
impl PartialEq for SurfaceSpec
Source§fn eq(&self, other: &SurfaceSpec) -> bool
fn eq(&self, other: &SurfaceSpec) -> bool
self and other values to be equal, and is used by ==.