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<Protocol, ProtocolError>
pub fn from_protobuf(bytes: &[u8]) -> Result<Protocol, 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) -> Protocol
pub fn new(protocol: WebUiProtocol) -> Protocol
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.
Auto Trait Implementations§
impl !Freeze for Protocol
impl RefUnwindSafe for Protocol
impl Send for Protocol
impl Sync for Protocol
impl Unpin for Protocol
impl UnsafeUnpin for Protocol
impl UnwindSafe for Protocol
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more