pub struct LinkRouteRegistry { /* private fields */ }Expand description
Registry for resolving route names to link definitions
This allows the framework to map URL paths like “/users/{id}/cars-owned” to the appropriate link definition and direction.
Implementations§
Source§impl LinkRouteRegistry
impl LinkRouteRegistry
Sourcepub fn new(config: Arc<LinksConfig>) -> Self
pub fn new(config: Arc<LinksConfig>) -> Self
Create a new registry from a links configuration
Sourcepub fn resolve_route(
&self,
entity_type: &str,
route_name: &str,
) -> Result<(LinkDefinition, LinkDirection)>
pub fn resolve_route( &self, entity_type: &str, route_name: &str, ) -> Result<(LinkDefinition, LinkDirection)>
Resolve a route name for a given entity type
Returns the link definition and the direction of navigation
Sourcepub fn list_routes_for_entity(&self, entity_type: &str) -> Vec<RouteInfo>
pub fn list_routes_for_entity(&self, entity_type: &str) -> Vec<RouteInfo>
List all available routes for a given entity type
Sourcepub fn config(&self) -> &LinksConfig
pub fn config(&self) -> &LinksConfig
Get the underlying configuration
Sourcepub fn detect_link_chains(&self, max_depth: usize) -> Vec<LinkChain>
pub fn detect_link_chains(&self, max_depth: usize) -> Vec<LinkChain>
Detect all possible link chains from the configuration (forward and reverse)
Returns a list of chains like: (source_type, [(route_name, target_type), …]) Example: (order, [(“invoices”, invoice), (“payments”, payment)]) for the chain: Order → Invoice → Payment
Auto Trait Implementations§
impl Freeze for LinkRouteRegistry
impl RefUnwindSafe for LinkRouteRegistry
impl Send for LinkRouteRegistry
impl Sync for LinkRouteRegistry
impl Unpin for LinkRouteRegistry
impl UnwindSafe for LinkRouteRegistry
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
Mutably borrows from an owned value. Read more