Annotate root crate tests with standalone_crate
The new Rustdoc combined tests are an order of magnitude slower in my machine for the `iced` root crate.
This commit is contained in:
parent
53ce0e3a88
commit
33d20763c8
2 changed files with 18 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
|||
//! Create and run iced applications step by step.
|
||||
//!
|
||||
//! # Example
|
||||
//! ```no_run
|
||||
//! ```no_run,standalone_crate
|
||||
//! use iced::widget::{button, column, text, Column};
|
||||
//! use iced::Theme;
|
||||
//!
|
||||
|
|
@ -42,7 +42,7 @@ use std::borrow::Cow;
|
|||
/// Creates an iced [`Application`] given its title, update, and view logic.
|
||||
///
|
||||
/// # Example
|
||||
/// ```no_run
|
||||
/// ```no_run,standalone_crate
|
||||
/// use iced::widget::{button, column, text, Column};
|
||||
///
|
||||
/// pub fn main() -> iced::Result {
|
||||
|
|
|
|||
32
src/lib.rs
32
src/lib.rs
|
|
@ -29,7 +29,7 @@
|
|||
//! # The Pocket Guide
|
||||
//! Start by calling [`run`]:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```no_run,standalone_crate
|
||||
//! pub fn main() -> iced::Result {
|
||||
//! iced::run("A cool counter", update, view)
|
||||
//! }
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
//!
|
||||
//! Define an `update` function to __change__ your state:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! fn update(counter: &mut u64, message: Message) {
|
||||
//! match message {
|
||||
//! Message::Increment => *counter += 1,
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
//!
|
||||
//! Define a `view` function to __display__ your state:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! use iced::widget::{button, text};
|
||||
//! use iced::Element;
|
||||
//!
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
//!
|
||||
//! And create a `Message` enum to __connect__ `view` and `update` together:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! #[derive(Debug, Clone)]
|
||||
//! enum Message {
|
||||
//! Increment,
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
//! ## Custom State
|
||||
//! You can define your own struct for your state:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! #[derive(Default)]
|
||||
//! struct Counter {
|
||||
//! value: u64,
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
//!
|
||||
//! But you have to change `update` and `view` accordingly:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # struct Counter { value: u64 }
|
||||
//! # #[derive(Clone)]
|
||||
//! # enum Message { Increment }
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
//!
|
||||
//! Widgets are configured using the builder pattern:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # struct Counter { value: u64 }
|
||||
//! # #[derive(Clone)]
|
||||
//! # enum Message { Increment }
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
//! Building your layout will often consist in using a combination of
|
||||
//! [rows], [columns], and [containers]:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # struct State;
|
||||
//! # enum Message {}
|
||||
//! use iced::widget::{column, container, row};
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
//!
|
||||
//! A fixed numeric [`Length`] in [`Pixels`] can also be used:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # struct State;
|
||||
//! # enum Message {}
|
||||
//! use iced::widget::container;
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
//! function and leveraging the [`Application`] builder, instead of directly
|
||||
//! calling [`run`]:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```no_run,standalone_crate
|
||||
//! # #[derive(Default)]
|
||||
//! # struct State;
|
||||
//! use iced::Theme;
|
||||
|
|
@ -227,7 +227,7 @@
|
|||
//!
|
||||
//! The appearance of a widget can be changed by calling its `style` method:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # struct State;
|
||||
//! # enum Message {}
|
||||
//! use iced::widget::container;
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
//! The `style` method of a widget takes a closure that, given the current active
|
||||
//! [`Theme`], returns the widget style:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # struct State;
|
||||
//! # #[derive(Clone)]
|
||||
//! # enum Message {}
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
//! A [`Task`] can be leveraged to perform asynchronous work, like running a
|
||||
//! future or a stream:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # #[derive(Clone)]
|
||||
//! # struct Weather;
|
||||
//! use iced::Task;
|
||||
|
|
@ -334,7 +334,7 @@
|
|||
//!
|
||||
//! You will need to define a `subscription` function and use the [`Application`] builder:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! ```no_run,standalone_crate
|
||||
//! # #[derive(Default)]
|
||||
//! # struct State;
|
||||
//! use iced::window;
|
||||
|
|
@ -375,7 +375,7 @@
|
|||
//! A common pattern is to leverage this composability to split an
|
||||
//! application into different screens:
|
||||
//!
|
||||
//! ```rust
|
||||
//! ```standalone_crate
|
||||
//! # mod contacts {
|
||||
//! # use iced::{Element, Task};
|
||||
//! # pub struct Contacts;
|
||||
|
|
@ -656,7 +656,7 @@ pub type Result = std::result::Result<(), Error>;
|
|||
/// This is equivalent to chaining [`application()`] with [`Application::run`].
|
||||
///
|
||||
/// # Example
|
||||
/// ```no_run
|
||||
/// ```no_run,standalone_crate
|
||||
/// use iced::widget::{button, column, text, Column};
|
||||
///
|
||||
/// pub fn main() -> iced::Result {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue