♻️ (pagetop): Optimiza cadenas con CowStr
This commit is contained in:
parent
cf7aba2b53
commit
b39ed38d0d
11 changed files with 229 additions and 159 deletions
|
|
@ -6,10 +6,9 @@ use crate::html::{html, Markup, RoutePath};
|
|||
use crate::html::{Assets, Favicon, JavaScript, StyleSheet};
|
||||
use crate::locale::{LangId, LanguageIdentifier, RequestLocale};
|
||||
use crate::service::HttpRequest;
|
||||
use crate::{builder_fn, util};
|
||||
use crate::{builder_fn, util, CowStr};
|
||||
|
||||
use std::any::Any;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Operaciones para modificar recursos asociados al [`Context`] de un documento.
|
||||
|
|
@ -376,7 +375,7 @@ impl Context {
|
|||
///
|
||||
/// Esto garantiza que los enlaces generados desde el contexto preservan la preferencia de
|
||||
/// idioma del usuario cuando procede.
|
||||
pub fn route(&self, path: impl Into<Cow<'static, str>>) -> RoutePath {
|
||||
pub fn route(&self, path: impl Into<CowStr>) -> RoutePath {
|
||||
let mut route = RoutePath::new(path);
|
||||
if self.locale.needs_lang_query() {
|
||||
route.alter_param("lang", self.locale.langid().to_string());
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ pub trait Theme: Extension + Send + Sync {
|
|||
&DefaultRegion::Content,
|
||||
ChildOp::Prepend(Child::with(
|
||||
Intro::new()
|
||||
.with_title(L10n::l("error_code").with_arg("code", code.as_str()))
|
||||
.with_title(L10n::l("error_code").with_arg("code", code.to_string()))
|
||||
.with_slogan(L10n::n(code.to_string()))
|
||||
.with_button(None)
|
||||
.with_opening(IntroOpening::Custom)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue