pub struct PluginHttpRouter { /* private fields */ }Expand description
Longest-prefix-first matcher. Insertion preserves declaration
order until Self::sort is called; once sorted, prefix
matching is deterministic for ambiguous prefixes (e.g.
/api/v1 wins over /api).
Implementations§
Source§impl PluginHttpRouter
impl PluginHttpRouter
pub fn new() -> Self
Sourcepub fn register(
&mut self,
plugin_id: &str,
mount_prefix: &str,
timeout: Option<Duration>,
) -> Result<(), RouteRegistrationError>
pub fn register( &mut self, plugin_id: &str, mount_prefix: &str, timeout: Option<Duration>, ) -> Result<(), RouteRegistrationError>
Register a plugin’s mount prefix. Duplicates are accepted
(last-write-wins per plugin_id), so a plugin that
re-registers (hot-spawn restart) replaces its own entry.
Rejects registrations colliding with RESERVED_PREFIXES
— daemon-internal paths (/health, /metrics, /pair,
/admin, /.well-known) cannot be hijacked. Caller
surfaces a warn-level log for rejected registrations so
operators see the cause; the plugin’s broker handler
stays unhooked from those routes.
Sourcepub fn match_path(&self, path: &str) -> Option<(&str, Duration)>
pub fn match_path(&self, path: &str) -> Option<(&str, Duration)>
Match a request path. Returns (plugin_id, timeout) if a
route covers it; the caller forwards via
forward_request.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for PluginHttpRouter
impl Clone for PluginHttpRouter
Source§fn clone(&self) -> PluginHttpRouter
fn clone(&self) -> PluginHttpRouter
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 PluginHttpRouter
impl Debug for PluginHttpRouter
Source§impl Default for PluginHttpRouter
impl Default for PluginHttpRouter
Source§fn default() -> PluginHttpRouter
fn default() -> PluginHttpRouter
Auto Trait Implementations§
impl Freeze for PluginHttpRouter
impl RefUnwindSafe for PluginHttpRouter
impl Send for PluginHttpRouter
impl Sync for PluginHttpRouter
impl Unpin for PluginHttpRouter
impl UnsafeUnpin for PluginHttpRouter
impl UnwindSafe for PluginHttpRouter
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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