mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
added ToHref impl for Rc<str> (#2857)
This commit is contained in:
parent
78dc8b4410
commit
ba40560ad7
1 changed files with 8 additions and 1 deletions
|
@ -3,7 +3,7 @@ use crate::{
|
|||
};
|
||||
use leptos::{children::Children, oco::Oco, prelude::*, *};
|
||||
use reactive_graph::{computed::ArcMemo, owner::use_context};
|
||||
use std::borrow::Cow;
|
||||
use std::{borrow::Cow, rc::Rc};
|
||||
|
||||
/// Describes a value that is either a static or a reactive URL, i.e.,
|
||||
/// a [`String`], a [`&str`], or a reactive `Fn() -> String`.
|
||||
|
@ -41,6 +41,13 @@ impl ToHref for Oco<'_, str> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToHref for Rc<str> {
|
||||
fn to_href(&self) -> Box<dyn Fn() -> String + '_> {
|
||||
let s = self.to_string();
|
||||
Box::new(move || s.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl<F> ToHref for F
|
||||
where
|
||||
F: Fn() -> String + 'static,
|
||||
|
|
Loading…
Reference in a new issue