Skip to main content

SurfaceModel

Struct SurfaceModel 

Source
pub struct SurfaceModel {
    pub id: String,
    pub catalog_id: String,
    pub surface_properties: Option<Value>,
    pub send_data_model: bool,
    pub data_model: RefCell<DataModel>,
    pub components: RefCell<SurfaceComponentsModel>,
    pub pending_actions: RefCell<HashMap<String, PendingAction>>,
}
Expand description

State for a single A2UI surface.

Fields§

§id: String

Unique surface identifier.

§catalog_id: String

Catalog URI this surface uses.

§surface_properties: Option<Value>

Optional surface properties (e.g. agentDisplayName).

§send_data_model: bool

Whether to send the full data model with actions.

§data_model: RefCell<DataModel>

The data model for this surface.

§components: RefCell<SurfaceComponentsModel>

The component tree for this surface.

§pending_actions: RefCell<HashMap<String, PendingAction>>

Actions that are awaiting a server response, keyed by action_id.

Implementations§

Source§

impl SurfaceModel

Source

pub fn new( id: String, catalog_id: String, surface_properties: Option<Value>, send_data_model: bool, ) -> Self

Create a new surface model.

Source

pub fn with_data_model(self, data: Value) -> Self

Initialize with a data model value.

Source

pub fn has_root(&self) -> bool

Check if the component tree has a root component.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.