Skip to main content

IEndpointCatalog

Trait IEndpointCatalog 

Source
pub trait IEndpointCatalog: Send + Sync {
    // Required method
    fn all(&self) -> &[EndpointDescriptor];

    // Provided methods
    fn get(&self, method: &str, path: &str) -> Option<&EndpointDescriptor> { ... }
    fn localized(&self, localizer: &dyn IStringLocalizer) -> Vec<EndpointInfo> { ... }
    fn localized_for(
        &self,
        localizer: &dyn IStringLocalizer,
        culture: &str,
    ) -> Vec<EndpointInfo> { ... }
}
Expand description

Runtime endpoint metadata source.

Resolved from the container (Arc<dyn IEndpointCatalog>) or from Host::endpoints(). Equivalent to ASP.NET Core’s EndpointDataSource: the list is read-only and fixed for the lifetime of the host.

Required Methods§

Source

fn all(&self) -> &[EndpointDescriptor]

Every endpoint, sorted by path then method.

path is the original route pattern string from the declaration.

Provided Methods§

Source

fn get(&self, method: &str, path: &str) -> Option<&EndpointDescriptor>

Look up one endpoint by its canonical method and declared route pattern.

Source

fn localized(&self, localizer: &dyn IStringLocalizer) -> Vec<EndpointInfo>

Resolve every endpoint’s text for the localizer’s default culture.

The order matches Self::all, so syncing the result into a database is idempotent.

Source

fn localized_for( &self, localizer: &dyn IStringLocalizer, culture: &str, ) -> Vec<EndpointInfo>

Resolve every endpoint’s text for an explicit culture.

Use the default Self::localized for administrative output; this variant is for deliberately producing another language’s view.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§