Skip to main content

serenade_view/
path.rs

1//! Reverse URL generation.
2
3use serenade_http::{HttpError, RouteCollection};
4
5/// Builds a path for the named route (Twig `path()` analogue).
6///
7/// # Errors
8///
9/// Propagates [`RouteCollection::generate`] failures.
10pub fn path(
11    routes: &RouteCollection,
12    name: &str,
13    params: &[(&str, &str)],
14) -> Result<String, HttpError> {
15    routes.generate(name, params)
16}