serenade-view 1.0.0

HTML view helpers: path, asset, partials (no template engine)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Reverse URL generation.

use serenade_http::{HttpError, RouteCollection};

/// Builds a path for the named route (Twig `path()` analogue).
///
/// # Errors
///
/// Propagates [`RouteCollection::generate`] failures.
pub fn path(
    routes: &RouteCollection,
    name: &str,
    params: &[(&str, &str)],
) -> Result<String, HttpError> {
    routes.generate(name, params)
}