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

Fix doc visibility issues. #2356

Merged
merged 2 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions druid-shell/src/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
1 change: 1 addition & 0 deletions druid-shell/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions druid/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl<T: Data> AppLauncher<T> {
/// # 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()
Expand Down
6 changes: 3 additions & 3 deletions druid/src/lens/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
14 changes: 7 additions & 7 deletions druid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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};

Expand All @@ -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;
2 changes: 2 additions & 0 deletions druid/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::{Env, FontDescriptor, FontFamily, FontStyle, FontWeight, Insets, Key}
pub const WINDOW_BACKGROUND_COLOR: Key<Color> =
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<Color> = TEXT_COLOR;
pub const TEXT_COLOR: Key<Color> = Key::new("org.linebender.druid.theme.label_color");
Expand Down Expand Up @@ -56,6 +57,7 @@ pub const BUTTON_BORDER_WIDTH: Key<f64> =
Key::new("org.linebender.druid.theme.button_border_width");
pub const BORDER_DARK: Key<Color> = Key::new("org.linebender.druid.theme.border_dark");
pub const BORDER_LIGHT: Key<Color> = 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<Color> = SELECTED_TEXT_BACKGROUND_COLOR;
pub const SELECTED_TEXT_BACKGROUND_COLOR: Key<Color> =
Expand Down
32 changes: 5 additions & 27 deletions druid/src/widget/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
1 change: 1 addition & 0 deletions druid/src/widget/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::widget::prelude::*;
use crate::Data;

/// Converts a `Widget<String>` to a `Widget<Option<T>>`, mapping parse errors to None
#[doc(hidden)]
#[deprecated(since = "0.7.0", note = "Use the Formatter trait instead")]
pub struct Parse<T> {
widget: T,
Expand Down
1 change: 1 addition & 0 deletions druid/src/widget/widget_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ pub trait WidgetExt<T: Data>: Widget<T> + Sized + 'static {
}

/// Parse a `Widget<String>`'s contents
#[doc(hidden)]
#[deprecated(since = "0.7.0", note = "Use TextBox::with_formatter instead")]
#[allow(deprecated)]
fn parse(self) -> Parse<Self>
Expand Down