pub struct Protocol { /* private fields */ }Expand description
A decoded protocol with reusable deterministic indices.
Construct this once when a server loads protocol.bin, then reuse it for
full renders, partial navigation, component-template requests, and token
queries. Full renders borrow the immutable protocol without locking.
Authored route patterns are precompiled once and matched as immutable
absolute patterns or relative suffixes. Parsed template metadata is
populated lazily behind a read-write lock whose scope is limited to
individual metadata lookups.
Implementations§
Source§impl Protocol
impl Protocol
Sourcepub fn from_protobuf(bytes: &[u8]) -> Result<Self, ProtocolError>
pub fn from_protobuf(bytes: &[u8]) -> Result<Self, ProtocolError>
Decode protobuf bytes and build the reusable protocol index.
§Errors
Returns a protocol error when bytes is not a valid WebUI protobuf.
Sourcepub fn new(protocol: WebUIProtocol) -> Self
pub fn new(protocol: WebUIProtocol) -> Self
Create a reusable runtime protocol from an already decoded document.
Sourcepub fn render_partial(
&self,
state_json: &str,
entry_id: &str,
request_path: &str,
inventory_hex: &str,
) -> Result<String, HandlerError>
pub fn render_partial( &self, state_json: &str, entry_id: &str, request_path: &str, inventory_hex: &str, ) -> Result<String, HandlerError>
Produce a complete partial-navigation response.
Sourcepub fn render_component_templates(
&self,
component_tags: &[&str],
inventory_hex: &str,
) -> Result<Value, HandlerError>
pub fn render_component_templates( &self, component_tags: &[&str], inventory_hex: &str, ) -> Result<Value, HandlerError>
Render component template payloads for requested component tags.