From fbf5c5a0d3a1f837b03cad89a68dc1797daf579b Mon Sep 17 00:00:00 2001 From: Maccesch Date: Mon, 5 Jun 2023 03:06:26 +0100 Subject: [PATCH] fixed docs and tests for unstable web apis --- .cargo/config.toml | 4 +--- CHANGELOG.md | 4 ++++ Cargo.toml | 3 ++- src/use_resize_observer.rs | 8 +++++--- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 32c533f..ae09f70 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,3 @@ [build] rustflags = ["--cfg=web_sys_unstable_apis"] - -[host] -rustflags = ["--cfg=web_sys_unstable_apis"] \ No newline at end of file +rustdocflags = ["--cfg=web_sys_unstable_apis"] \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 997602c..6c96a19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.8 + +- Fixed documentation and doc tests running for functions behind `#[cfg(web_sys_unstable_apis)]` + ## 0.1.7 #### New Function diff --git a/Cargo.toml b/Cargo.toml index c260d7a..0b614d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leptos-use" -version = "0.1.7" +version = "0.1.8" edition = "2021" authors = ["Marc-Stefan Cassola"] categories = ["gui", "web-programming"] @@ -46,3 +46,4 @@ math = ["num"] [package.metadata."docs.rs"] all-features = true +rustdoc-args = ["--cfg=web_sys_unstable_apis"] \ No newline at end of file diff --git a/src/use_resize_observer.rs b/src/use_resize_observer.rs index a0de787..ad63851 100644 --- a/src/use_resize_observer.rs +++ b/src/use_resize_observer.rs @@ -27,7 +27,7 @@ use wasm_bindgen::prelude::*; /// # #[component] /// # fn Demo(cx: Scope) -> impl IntoView { /// let el = create_node_ref(cx); -/// let (text, set_text) = create_signal(cx, ""); +/// let (text, set_text) = create_signal(cx, "".to_string()); /// /// use_resize_observer( /// cx, @@ -37,8 +37,10 @@ use wasm_bindgen::prelude::*; /// set_text(format!("width: {}\nheight: {}", rect.width(), rect.height())); /// }, /// ); -/// # -/// # view! { cx, } +/// +/// view! { cx, +///
{ text }
+/// } /// # } /// ``` /// ## See also