Skip to content

Commit

Permalink
Fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PoignardAzur committed Jan 23, 2025
1 parent 60989b0 commit 5afc415
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion masonry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The to-do-list example looks like this:

```rust
use masonry::dpi::LogicalSize;
use masonry::widget::{Button, Flex, Label, Portal, RootWidget, Textbox, WidgetMut};
use masonry::widgets::{Button, Flex, Label, Portal, RootWidget, Textbox, WidgetMut};
use masonry::{Action, AppDriver, DriverCtx, WidgetId};
use winit::window::Window;

Expand Down
8 changes: 4 additions & 4 deletions masonry/src/doc/01_creating_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Let's start with the `main()` function.
fn main() {
const VERTICAL_WIDGET_SPACING: f64 = 20.0;
use masonry::widget::{Button, Flex, Portal, RootWidget, Textbox};
use masonry::widgets::{Button, Flex, Portal, RootWidget, Textbox};
let main_widget = Portal::new(
Flex::column()
Expand Down Expand Up @@ -80,7 +80,7 @@ We create a `Driver` struct to store a very simple app's state, and we implement

```rust
use masonry::{Action, AppDriver, DriverCtx, WidgetId};
use masonry::widget::{Flex, Label, Portal, RootWidget, WidgetMut};
use masonry::widgets::{Flex, Label, Portal, RootWidget, WidgetMut};

struct Driver {
next_task: String,
Expand Down Expand Up @@ -173,7 +173,7 @@ Our complete program therefore looks like this:
fn main() {
const VERTICAL_WIDGET_SPACING: f64 = 20.0;

use masonry::widget::{Button, Flex, Portal, RootWidget, Textbox};
use masonry::widgets::{Button, Flex, Portal, RootWidget, Textbox};

let main_widget = Portal::new(
Flex::column()
Expand All @@ -187,7 +187,7 @@ fn main() {
let main_widget = RootWidget::new(main_widget);

use masonry::{Action, AppDriver, DriverCtx, WidgetId};
use masonry::widget::{Label};
use masonry::widgets::{Label};

struct Driver {
next_task: String,
Expand Down
2 changes: 1 addition & 1 deletion masonry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//!
//! ```
//! use masonry::dpi::LogicalSize;
//! use masonry::widget::{Button, Flex, Label, Portal, RootWidget, Textbox, WidgetMut};
//! use masonry::widgets::{Button, Flex, Label, Portal, RootWidget, Textbox, WidgetMut};
//! use masonry::{Action, AppDriver, DriverCtx, WidgetId};
//! use winit::window::Window;
//!
Expand Down
2 changes: 1 addition & 1 deletion masonry/src/testing/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use crate::{Color, Handled, Point, Size, Vec2, Widget, WidgetId};
/// use insta::assert_debug_snapshot;
///
/// use masonry::PointerButton;
/// use masonry::widget::Button;
/// use masonry::widgets::Button;
/// use masonry::Action;
/// use masonry::assert_render_snapshot;
/// use masonry::testing::widget_ids;
Expand Down
2 changes: 1 addition & 1 deletion masonry/src/testing/helper_widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct ReplaceChild {
/// Make one like this:
///
/// ```
/// # use masonry::widget::Label;
/// # use masonry::widgets::Label;
/// # use masonry::{Update};
/// use masonry::testing::{Recording, Record, TestWidgetExt};
/// use masonry::testing::TestHarness;
Expand Down
4 changes: 2 additions & 2 deletions masonry/src/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Button {
/// # Examples
///
/// ```
/// use masonry::widget::Button;
/// use masonry::widgets::Button;
///
/// let button = Button::new("Increment");
/// ```
Expand All @@ -51,7 +51,7 @@ impl Button {
///
/// ```
/// use masonry::Color;
/// use masonry::widget::{Button, Label};
/// use masonry::widgets::{Button, Label};
///
/// let label = Label::new("Increment").with_brush(Color::new([0.5, 0.5, 0.5, 1.0]));
/// let button = Button::from_label(label);
Expand Down
2 changes: 1 addition & 1 deletion masonry/src/widgets/flex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ fn new_flex_child(params: FlexParams, widget: WidgetPod<dyn Widget>) -> Child {
flex,
}
} else {
tracing::warn!("Flex value should be > 0.0 (was {flex}). See the docs for masonry::widget::Flex for more information");
tracing::warn!("Flex value should be > 0.0 (was {flex}). See the docs for masonry::widgets::Flex for more information");
Child::Fixed {
widget,
alignment: params.alignment,
Expand Down
2 changes: 1 addition & 1 deletion xilem/src/view/flex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{AnyWidgetView, Pod, ViewCtx, WidgetView};
///
/// # Example
/// ```rust,no_run
/// use masonry::widget::{CrossAxisAlignment, MainAxisAlignment};
/// use masonry::widgets::{CrossAxisAlignment, MainAxisAlignment};
/// use winit::error::EventLoopError;
/// use xilem::view::{button, flex, label, sized_box, Axis, FlexExt as _, FlexSpacer, Label};
/// use xilem::{EventLoop, WidgetView, Xilem};
Expand Down
6 changes: 3 additions & 3 deletions xilem/src/view/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{Pod, ViewCtx, WidgetView};
///
/// # Example
/// ```ignore
/// use masonry::widget::GridParams;
/// use masonry::widgets::GridParams;
/// use xilem::view::{
/// button, grid, label, GridExt,
/// };
Expand Down Expand Up @@ -290,7 +290,7 @@ pub trait GridExt<State, Action>: WidgetView<State, Action> {
///
/// # Examples
/// ```
/// use masonry::widget::GridParams;
/// use masonry::widgets::GridParams;
/// use xilem::{view::{button, prose, grid, GridExt}};
/// # use xilem::{WidgetView};
///
Expand All @@ -317,7 +317,7 @@ pub trait GridExt<State, Action>: WidgetView<State, Action> {
///
/// # Examples
/// ```
/// use masonry::widget::GridParams;
/// use masonry::widgets::GridParams;
/// use xilem::{view::{button, prose, grid, GridExt}};
/// # use xilem::{WidgetView};
///
Expand Down
2 changes: 1 addition & 1 deletion xilem/src/view/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct Label {
text_size: f32,
weight: FontWeight,
font: FontStack<'static>,
line_break_mode: LineBreaking, // TODO: add more attributes of `masonry::widget::Label`
line_break_mode: LineBreaking, // TODO: add more attributes of `masonry::widgets::Label`
}

impl Label {
Expand Down
2 changes: 1 addition & 1 deletion xilem/src/view/portal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{MessageResult, Pod, View, ViewCtx, ViewId, WidgetView};

/// A view which puts `child` into a scrollable region.
///
/// This corresponds to the Masonry [`Portal`](masonry::widget::Portal) widget.
/// This corresponds to the Masonry [`Portal`](masonry::widgets::Portal) widget.
pub fn portal<Child, State, Action>(child: Child) -> Portal<Child, State, Action>
where
Child: WidgetView<State, Action>,
Expand Down
2 changes: 1 addition & 1 deletion xilem/src/view/prose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct Prose {
text_size: f32,
line_break_mode: LineBreaking,
// TODO: disabled: bool,
// TODO: add more attributes of `masonry::widget::Prose`
// TODO: add more attributes of `masonry::widgets::Prose`
}

impl Prose {
Expand Down
2 changes: 1 addition & 1 deletion xilem/src/view/sized_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{Pod, ViewCtx, WidgetView};
/// use xilem::view::{sized_box, button};
/// use xilem::palette;
/// use vello::kurbo::RoundedRectRadii;
/// use masonry::widget::Padding;
/// use masonry::widgets::Padding;
///
/// sized_box(button("Button", |data: &mut i32| *data+=1))
/// .expand()
Expand Down
2 changes: 1 addition & 1 deletion xilem/src/view/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct Textbox<State, Action> {
on_enter: Option<Callback<State, Action>>,
text_brush: Brush,
alignment: TextAlignment,
// TODO: add more attributes of `masonry::widget::TextBox`
// TODO: add more attributes of `masonry::widgets::TextBox`
}

impl<State, Action> Textbox<State, Action> {
Expand Down

0 comments on commit 5afc415

Please sign in to comment.