leptos-use/src/use_to_string.rs
Maccesch ec6027c59e Merge branch 'main' into leptos-0.7
# Conflicts:
#	CHANGELOG.md
#	Cargo.toml
#	src/is_err.rs
#	src/is_none.rs
#	src/is_ok.rs
#	src/is_some.rs
#	src/storage/use_local_storage.rs
#	src/storage/use_session_storage.rs
#	src/storage/use_storage.rs
#	src/use_broadcast_channel.rs
#	src/use_cookie.rs
#	src/use_device_pixel_ratio.rs
#	src/use_event_source.rs
#	src/use_to_string.rs
#	src/use_websocket.rs
#	src/utils/codecs/string/from_to_string.rs
#	src/utils/codecs/string/json.rs
#	src/utils/codecs/string/prost.rs
2024-07-22 23:12:46 +01:00

22 lines
531 B
Rust

use leptos::prelude::*;
crate::use_derive_signal!(
/// Reactive `ToString::to_string()`.
///
/// ## Usage
///
/// ```
/// # use leptos::prelude::*;
/// # use leptos_use::use_to_string;
/// #
/// # #[component]
/// # fn Demo() -> impl IntoView {
/// let (number, set_number) = signal(3.14_f64);
/// let str = use_to_string::<_, f64>(number);
/// #
/// # view! { }
/// # }
/// ```
use_to_string<T, T: ToString + 'static> -> String
|value| value.to_string()
);