Skip to main content

Protocol

Struct Protocol 

Source
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

Source

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.

Source

pub fn new(protocol: WebUIProtocol) -> Self

Create a reusable runtime protocol from an already decoded document.

Source

pub fn tokens(&self) -> &[String]

Borrow the build-time CSS token list.

Source

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.

Source

pub fn render_component_templates( &self, component_tags: &[&str], inventory_hex: &str, ) -> Result<Value, HandlerError>

Render component template payloads for requested component tags.

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 = !

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.