Skip to main content

RoutingTable

Struct RoutingTable 

Source
pub struct RoutingTable { /* private fields */ }
Expand description

The parsed routing table (Java RoutingEntry).

Implementations§

Source§

impl RoutingTable

Source

pub fn load(reader: &ConfigReader) -> Result<Self, AppError>

Load and validate a rest.yaml (Java RoutingEntry.load). Invalid entries fail the load — the grammar’s parser invariants.

Source

pub fn retain_available( &mut self, is_registered: impl Fn(&str) -> bool, ) -> Vec<(String, String, String)>

Drop every entry whose target is a function route that is not registered, the way Java’s RoutingEntry.resolveServices does at load (po.exists(service), else “Skip [methods] url - Service x not available” as a warning). An entry whose backing function was left out, such as an #[optional_service] whose condition is false or a typo, must not become a live URL that answers “Route … not found”. HTTP(S) targets are not routes and are never checked. Returns the skipped entries’ ("[methods]", url, service) for the caller to log.

Source

pub fn static_content(&self) -> &StaticContent

The static-content configuration (defaults applied when absent).

Source

pub fn from_yaml_text(yaml: &str) -> Result<Self, AppError>

Build a routing table from YAML text (used for the built-in default endpoints — same parser, same invariants).

Source

pub fn routes(&self) -> &[RouteInfo]

Source

pub fn has_url(&self, url: &str) -> bool

Whether any entry already claims this URL (used by the default-endpoint merge: user entries always win — Java default-rest.yaml semantics).

Source

pub fn find(&self, method: &str, path: &str) -> Option<AssignedRoute<'_>>

Match a request (Java getRouteInfo): candidates must match every segment; precedence is more literal segments first, wildcard last. Method filtering happens here too — OPTIONS matches any entry (CORS preflight, auto-added per the grammar).

Source

pub fn path_matches_any_method(&self, path: &str) -> bool

True when the path matches SOME entry regardless of method — the Java getSimilarRoute marker (increment 56, parity F14c): a known path with a wrong method answers 405 “Method not allowed”, never 404.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V