Skip to content

Allow to pass signals to borrowed to sizes#63

Open
mondeja wants to merge 1 commit into
carloskiki:mainfrom
mondeja:borrowed-size
Open

Allow to pass signals to borrowed to sizes#63
mondeja wants to merge 1 commit into
carloskiki:mainfrom
mondeja:borrowed-size

Conversation

@mondeja

@mondeja mondeja commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

Currently, if you try to pass a Signal<&str> to Icon's props width and height, the next error is raised:

the trait `From<leptos::prelude::Signal<&str>>` is not implemented for `MaybeProp<std::string::String>`

This is not happening for plain &'static str because there is a impl for Debug here:

impl<T, S> Debug for MaybeProp<T, S>
where
    T: Debug + 'static,

So better use TextProp.

@mondeja

mondeja commented Jun 23, 2025

Copy link
Copy Markdown
Contributor Author

Is not unwind safe because the calls to .get() are propagating to into_attribute_value.

https://github.com/leptos-rs/leptos/blob/f51c676e0df12a0b1192ec599360ce8006eb9750/leptos/src/text_prop.rs#L78

impl IntoAttributeValue for TextProp {
    type Output = Arc<dyn Fn() -> Oco<'static, str> + Send + Sync>;

    fn into_attribute_value(self) -> Self::Output {
        self.0
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant