Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document features automatically. #2780

Merged
merged 5 commits into from Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/yew/src/app_handle.rs
Expand Up @@ -9,7 +9,7 @@ use crate::dom_bundle::BSubtree;
use crate::html::{BaseComponent, NodeRef, Scope, Scoped};

/// An instance of an application.
#[cfg_attr(documenting, doc(cfg(feature = "csr")))]
#[cfg(feature = "csr")]
#[derive(Debug)]
pub struct AppHandle<COMP: BaseComponent> {
/// `Scope` holder
Expand Down Expand Up @@ -65,7 +65,6 @@ fn clear_element(host: &Element) {
}
}

#[cfg_attr(documenting, doc(cfg(feature = "hydration")))]
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion packages/yew/src/dom_bundle/subtree_root.rs
Expand Up @@ -232,7 +232,7 @@ static BUBBLE_EVENTS: AtomicBool = AtomicBool::new(true);
/// handler has no effect.
///
/// This function should be called before any component is mounted.
#[cfg_attr(documenting, doc(cfg(feature = "csr")))]
#[cfg(feature = "csr")]
pub fn set_event_bubbling(bubble: bool) {
BUBBLE_EVENTS.store(bubble, Ordering::Relaxed);
}
Expand Down
8 changes: 0 additions & 8 deletions packages/yew/src/functional/hooks/mod.rs
Expand Up @@ -3,29 +3,21 @@ mod use_context;
mod use_effect;
mod use_force_update;
mod use_memo;
#[cfg_attr(documenting, doc(cfg(any(target_arch = "wasm32", feature = "tokio"))))]
#[cfg(any(target_arch = "wasm32", feature = "tokio"))]
mod use_prepared_state;
mod use_reducer;
mod use_ref;
mod use_state;
#[cfg_attr(documenting, doc(cfg(any(target_arch = "wasm32", feature = "tokio"))))]
#[cfg(any(target_arch = "wasm32", feature = "tokio"))]
mod use_transitive_state;

pub use use_callback::*;
pub use use_context::*;
pub use use_effect::*;
pub use use_force_update::*;
pub use use_memo::*;
#[cfg_attr(documenting, doc(cfg(any(target_arch = "wasm32", feature = "tokio"))))]
#[cfg(any(target_arch = "wasm32", feature = "tokio"))]
pub use use_prepared_state::*;
pub use use_reducer::*;
pub use use_ref::*;
pub use use_state::*;
#[cfg_attr(documenting, doc(cfg(any(target_arch = "wasm32", feature = "tokio"))))]
#[cfg(any(target_arch = "wasm32", feature = "tokio"))]
pub use use_transitive_state::*;

use crate::functional::HookContext;
Expand Down
Expand Up @@ -89,7 +89,6 @@ pub use feat_ssr::*;
/// Whilst async closure is an unstable feature, the procedural macro will rewrite this to a
/// closure that returns an async block automatically. You can use this hook with async closure
/// in stable Rust.
#[cfg_attr(documenting, doc(cfg(any(target_arch = "wasm32", feature = "tokio"))))]
pub use use_prepared_state_macro as use_prepared_state;
// With SSR.
#[doc(hidden)]
Expand Down
Expand Up @@ -55,7 +55,6 @@ pub use feat_ssr::*;
/// You MUST denote the return type of the closure with `|deps| -> ReturnType { ... }`. This
/// type is used during client side rendering to deserialize the state prepared on the server
/// side.
#[cfg_attr(documenting, doc(cfg(any(target_arch = "wasm32", feature = "tokio"))))]
pub use use_transitive_state_macro as use_transitive_state;
// With SSR.
#[doc(hidden)]
Expand Down
1 change: 0 additions & 1 deletion packages/yew/src/html/component/scope.rs
Expand Up @@ -609,7 +609,6 @@ mod feat_csr {
#[cfg(feature = "csr")]
pub(crate) use feat_csr::*;

#[cfg_attr(documenting, doc(cfg(feature = "hydration")))]
#[cfg(feature = "hydration")]
mod feat_hydration {
use wasm_bindgen::JsCast;
Expand Down
1 change: 1 addition & 0 deletions packages/yew/src/lib.rs
@@ -1,6 +1,7 @@
#![allow(clippy::needless_doctest_main)]
#![doc(html_logo_url = "https://yew.rs/img/logo.png")]
#![cfg_attr(documenting, feature(doc_cfg))]
#![cfg_attr(documenting, feature(doc_auto_cfg))]
#![cfg_attr(
feature = "nightly",
feature(fn_traits, async_closure, unboxed_closures)
Expand Down
5 changes: 2 additions & 3 deletions packages/yew/src/renderer.rs
Expand Up @@ -14,7 +14,7 @@ thread_local! {
/// Set a custom panic hook.
/// Unless a panic hook is set through this function, Yew will
/// overwrite any existing panic hook when an application is rendered with [Renderer].
#[cfg_attr(documenting, doc(cfg(feature = "csr")))]
#[cfg(feature = "csr")]
pub fn set_custom_panic_hook(hook: Box<dyn Fn(&PanicInfo<'_>) + Sync + Send + 'static>) {
std::panic::set_hook(hook);
PANIC_HOOK_IS_SET.with(|hook_is_set| hook_is_set.set(true));
Expand All @@ -29,7 +29,7 @@ fn set_default_panic_hook() {
/// The Yew Renderer.
///
/// This is the main entry point of a Yew application.
#[cfg_attr(documenting, doc(cfg(feature = "csr")))]
#[cfg(feature = "csr")]
#[derive(Debug)]
#[must_use = "Renderer does nothing unless render() is called."]
pub struct Renderer<COMP>
Expand Down Expand Up @@ -93,7 +93,6 @@ where
}
}

#[cfg_attr(documenting, doc(cfg(feature = "hydration")))]
#[cfg(feature = "hydration")]
mod feat_hydration {
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions packages/yew/src/server_renderer.rs
Expand Up @@ -7,7 +7,7 @@ use crate::platform::io::{self, DEFAULT_BUF_SIZE};
use crate::platform::{run_pinned, spawn_local};

/// A Yew Server-side Renderer that renders on the current thread.
#[cfg_attr(documenting, doc(cfg(feature = "ssr")))]
#[cfg(feature = "ssr")]
#[derive(Debug)]
pub struct LocalServerRenderer<COMP>
where
Expand Down Expand Up @@ -112,7 +112,7 @@ where
/// the rendering process has finished.
///
/// See [`yew::platform`] for more information.
#[cfg_attr(documenting, doc(cfg(feature = "ssr")))]
#[cfg(feature = "ssr")]
pub struct ServerRenderer<COMP>
where
COMP: BaseComponent,
Expand Down