From 0d41ca7e43b7a01873602308471e1eeff8cd1f09 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 9 Feb 2023 01:33:06 +0200 Subject: [PATCH 1/2] Fix doc visibility issues. --- druid-shell/src/mouse.rs | 1 + druid-shell/src/region.rs | 1 + druid/src/app.rs | 1 + druid/src/lens/mod.rs | 6 +++--- druid/src/lib.rs | 14 +++++++------- druid/src/theme.rs | 2 ++ druid/src/widget/mod.rs | 32 +++++--------------------------- druid/src/widget/parse.rs | 1 + druid/src/widget/widget_ext.rs | 1 + 9 files changed, 22 insertions(+), 37 deletions(-) diff --git a/druid-shell/src/mouse.rs b/druid-shell/src/mouse.rs index 729352a802..b280b895ed 100644 --- a/druid-shell/src/mouse.rs +++ b/druid-shell/src/mouse.rs @@ -255,6 +255,7 @@ pub enum Cursor { Pointer, Crosshair, + #[doc(hidden)] #[deprecated( since = "0.8.0", note = "This will be removed because it is not available on Windows." diff --git a/druid-shell/src/region.rs b/druid-shell/src/region.rs index f47175be4c..132bdc1e15 100644 --- a/druid-shell/src/region.rs +++ b/druid-shell/src/region.rs @@ -59,6 +59,7 @@ impl Region { } } + #[doc(hidden)] #[deprecated(since = "0.7.0", note = "Use bounding_box() instead")] // this existed on the previous Region type, and I've bumped into it // a couple times while updating diff --git a/druid/src/app.rs b/druid/src/app.rs index a20d701dca..4d1e0a0447 100644 --- a/druid/src/app.rs +++ b/druid/src/app.rs @@ -172,6 +172,7 @@ impl AppLauncher { /// # Panics /// /// Panics if the logger fails to initialize. + #[doc(hidden)] #[deprecated(since = "0.8.0", note = "Use log_to_console instead")] pub fn use_simple_logger(self) -> Self { self.log_to_console() diff --git a/druid/src/lens/mod.rs b/druid/src/lens/mod.rs index 585f6c7c4e..11ae7af11f 100644 --- a/druid/src/lens/mod.rs +++ b/druid/src/lens/mod.rs @@ -52,6 +52,6 @@ #[allow(clippy::module_inception)] #[macro_use] mod lens; -pub use lens::{Constant, Deref, Field, Identity, InArc, Index, Map, Ref, Then, Unit}; -#[doc(hidden)] -pub use lens::{Lens, LensExt}; +pub use lens::{ + Constant, Deref, Field, Identity, InArc, Index, Lens, LensExt, Map, Ref, Then, Unit, +}; diff --git a/druid/src/lib.rs b/druid/src/lib.rs index acbe9a80ac..0c9bdc400a 100644 --- a/druid/src/lib.rs +++ b/druid/src/lib.rs @@ -135,13 +135,7 @@ //! the console to be shown, use `#![windows_subsystem = "windows"]` at the beginning of your //! crate. //! -//! [`Widget`]: trait.Widget.html -//! [`Data`]: trait.Data.html -//! [`Lens`]: trait.Lens.html -//! [`widget`]: ./widget/index.html -//! [`Event`]: enum.Event.html //! [`druid-shell`]: druid_shell -//! [`piet`]: piet //! [`druid/examples`]: https://github.com/linebender/druid/tree/v0.8.2/druid/examples //! [Druid book]: https://linebender.org/druid/ //! [`im` crate]: https://crates.io/crates/im @@ -231,13 +225,15 @@ pub use app_delegate::{AppDelegate, DelegateCtx}; pub use box_constraints::BoxConstraints; pub use command::{sys as commands, Command, Notification, Selector, SingleUse, Target}; pub use contexts::{EventCtx, LayoutCtx, LifeCycleCtx, PaintCtx, UpdateCtx}; -pub use data::Data; +pub use data::*; // Wildcard because rustdoc has trouble inlining docs of two things called Data pub use dialog::FileDialogOptions; +#[doc(inline)] pub use env::{Env, Key, KeyOrValue, Value, ValueType, ValueTypeError}; pub use event::{Event, InternalEvent, InternalLifeCycle, LifeCycle, ViewContext}; pub use ext_event::{ExtEventError, ExtEventSink}; pub use lens::{Lens, LensExt}; pub use localization::LocalizedString; +#[doc(inline)] pub use menu::{sys as platform_menus, Menu, MenuItem}; pub use mouse::MouseEvent; pub use util::Handled; @@ -248,8 +244,10 @@ pub use window::{Window, WindowId}; #[cfg(not(target_arch = "wasm32"))] pub(crate) use event::{DebugStateCell, StateCell, StateCheckFn}; +#[doc(hidden)] #[deprecated(since = "0.8.0", note = "import from druid::text module instead")] pub use piet::{FontFamily, FontStyle, FontWeight, TextAlignment}; +#[doc(hidden)] #[deprecated(since = "0.8.0", note = "import from druid::text module instead")] pub use text::{ArcStr, FontDescriptor, TextLayout}; @@ -261,9 +259,11 @@ pub use text::{ArcStr, FontDescriptor, TextLayout}; /// alias is provided to make that transition easy, but in any case make /// an explicit choice whether to use meaning or physical location and /// use the appropriate type. +#[doc(hidden)] #[deprecated(since = "0.7.0", note = "Use KbKey instead")] pub type KeyCode = KbKey; +#[doc(hidden)] #[deprecated(since = "0.7.0", note = "Use Modifiers instead")] /// See [`Modifiers`](struct.Modifiers.html). pub type KeyModifiers = Modifiers; diff --git a/druid/src/theme.rs b/druid/src/theme.rs index 4bbb32d335..4df7178006 100644 --- a/druid/src/theme.rs +++ b/druid/src/theme.rs @@ -25,6 +25,7 @@ use crate::{Env, FontDescriptor, FontFamily, FontStyle, FontWeight, Insets, Key} pub const WINDOW_BACKGROUND_COLOR: Key = Key::new("org.linebender.druid.theme.window_background_color"); +#[doc(hidden)] #[deprecated(since = "0.8.0", note = "renamed to TEXT_COLOR")] pub const LABEL_COLOR: Key = TEXT_COLOR; pub const TEXT_COLOR: Key = Key::new("org.linebender.druid.theme.label_color"); @@ -56,6 +57,7 @@ pub const BUTTON_BORDER_WIDTH: Key = Key::new("org.linebender.druid.theme.button_border_width"); pub const BORDER_DARK: Key = Key::new("org.linebender.druid.theme.border_dark"); pub const BORDER_LIGHT: Key = Key::new("org.linebender.druid.theme.border_light"); +#[doc(hidden)] #[deprecated(since = "0.8.0", note = "use SELECTED_TEXT_BACKGROUND_COLOR instead")] pub const SELECTION_COLOR: Key = SELECTED_TEXT_BACKGROUND_COLOR; pub const SELECTED_TEXT_BACKGROUND_COLOR: Key = diff --git a/druid/src/widget/mod.rs b/druid/src/widget/mod.rs index 777228fc97..b2e272188c 100644 --- a/druid/src/widget/mod.rs +++ b/druid/src/widget/mod.rs @@ -106,41 +106,19 @@ pub use tabs::{AddTab, TabInfo, Tabs, TabsEdge, TabsPolicy, TabsState, TabsTrans pub use textbox::TextBox; pub use value_textbox::{TextBoxEvent, ValidationDelegate, ValueTextBox}; pub use view_switcher::ViewSwitcher; -#[doc(hidden)] pub use widget::{Widget, WidgetId}; -#[doc(hidden)] pub use widget_ext::WidgetExt; pub use widget_wrapper::WidgetWrapper; pub use z_stack::ZStack; /// The types required to implement a [`Widget`]. -/// -/// # Structs -/// [`BoxConstraints`](crate::BoxConstraints)\ -/// [`Env`](crate::Env)\ -/// [`EventCtx`](crate::EventCtx)\ -/// [`LayoutCtx`](crate::LayoutCtx)\ -/// [`LifeCycleCtx`](crate::LifeCycleCtx)\ -/// [`PaintCtx`](crate::PaintCtx)\ -/// [`Size`](crate::Size)\ -/// [`UpdateCtx`](crate::UpdateCtx)\ -/// [`WidgetId`](crate::WidgetId)\ -/// -/// # Enums -/// [`Event`](crate::Event)\ -/// [`LifeCycle`](crate::LifeCycle)\ -/// -/// # Traits -/// [`Data`](crate::Data)\ -/// [`RenderContext`](crate::RenderContext)\ -/// [`Widget`] -/// -/// [`Widget`]: crate::Widget -// NOTE: \ at the end works as a line break, but skip on last line! pub mod prelude { - #[doc(hidden)] + // Wildcard because rustdoc has trouble inlining docs of two things called Data + pub use crate::data::*; + + #[doc(inline)] pub use crate::{ - BoxConstraints, Data, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, PaintCtx, + BoxConstraints, Env, Event, EventCtx, LayoutCtx, LifeCycle, LifeCycleCtx, PaintCtx, RenderContext, Size, UpdateCtx, Widget, WidgetId, }; } diff --git a/druid/src/widget/parse.rs b/druid/src/widget/parse.rs index a06ad8bad7..65126407a5 100644 --- a/druid/src/widget/parse.rs +++ b/druid/src/widget/parse.rs @@ -26,6 +26,7 @@ use crate::widget::prelude::*; use crate::Data; /// Converts a `Widget` to a `Widget>`, mapping parse errors to None +#[doc(hidden)] #[deprecated(since = "0.7.0", note = "Use the Formatter trait instead")] pub struct Parse { widget: T, diff --git a/druid/src/widget/widget_ext.rs b/druid/src/widget/widget_ext.rs index 0fcb23a7ae..ba0e61021b 100644 --- a/druid/src/widget/widget_ext.rs +++ b/druid/src/widget/widget_ext.rs @@ -218,6 +218,7 @@ pub trait WidgetExt: Widget + Sized + 'static { } /// Parse a `Widget`'s contents + #[doc(hidden)] #[deprecated(since = "0.7.0", note = "Use TextBox::with_formatter instead")] #[allow(deprecated)] fn parse(self) -> Parse From 2739383dabe039ddfc7f8d21036efe1642089b5d Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 9 Feb 2023 02:02:55 +0200 Subject: [PATCH 2/2] Add changelog entry. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11ac965c15..fbc082d219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ You can find its changes [documented below](#082---2023-01-27). ### Docs +- `Widget`, `WidgetExt`, `WidgetId`, `Lens` and `LensExt` docs are visible again. ([#2356] by [@xStrom]) +- Deprecated items are now hidden. ([#2356] by [@xStrom]) - Fixed `rustdoc` example scraping configuration. ([#2353] by [@xStrom]) - Added info about git symlinks to `CONTRIBUTING.md`. ([#2349] by [@xStrom]) @@ -1207,6 +1209,7 @@ Last release without a changelog :( [#2351]: https://github.com/linebender/druid/pull/2351 [#2352]: https://github.com/linebender/druid/pull/2352 [#2353]: https://github.com/linebender/druid/pull/2353 +[#2356]: https://github.com/linebender/druid/pull/2356 [Unreleased]: https://github.com/linebender/druid/compare/v0.8.2...master [0.8.2]: https://github.com/linebender/druid/compare/v0.8.1...v0.8.2