Skip to content

Commit

Permalink
set up example scaping for docs.rs (#2450)
Browse files Browse the repository at this point in the history
  • Loading branch information
ealmloff authored May 28, 2024
1 parent afc1c7f commit b3cd4fa
Show file tree
Hide file tree
Showing 36 changed files with 372 additions and 29 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 114 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ axum-extra = "0.9.2"
reqwest = "0.11.24"
owo-colors = "4.0.0"

[workspace.dev-dependencies]
isnta = "1.36.1"

# speed up some macros by optimizing them
[profile.dev.package.insta]
opt-level = 3
Expand Down Expand Up @@ -199,27 +196,139 @@ http = ["reqwest", "http-range"]
[[example]]
name = "login_form"
required-features = ["http"]
doc-scrape-examples = true

[[example]]
name = "dog_app"
required-features = ["http"]
doc-scrape-examples = true

[[example]]
name = "video_stream"
required-features = ["http"]
required-features = ["http", "desktop"]
doc-scrape-examples = true

[[example]]
name = "suspense"
required-features = ["http"]
required-features = ["http", "desktop"]
doc-scrape-examples = true

[[example]]
name = "weather_app"
required-features = ["http"]
doc-scrape-examples = true

[[example]]
name = "image_generator_openai"
required-features = ["http"]
doc-scrape-examples = true

[[example]]
name = "hash_fragment_state"
required-features = ["ciborium", "base64"]
doc-scrape-examples = true

[[example]]
name = "backgrounded_futures"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "calculator_mutable"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "calculator"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "clock"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "crm"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "custom_html"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "custom_menu"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "dynamic_asset"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "error_handle"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "file_explorer"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "future"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "hydration"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "multiwindow"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "overlay"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "popup"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "read_size"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "shortcut"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "streams"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "window_event"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "window_focus"
required-features = ["desktop"]
doc-scrape-examples = true

[[example]]
name = "window_zoom"
required-features = ["desktop"]
doc-scrape-examples = true
2 changes: 1 addition & 1 deletion examples/generic_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use dioxus::prelude::*;
use std::fmt::Display;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/login_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/memo_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/scroll_to_top.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/shorthand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use dioxus::prelude::*;
use std::time::Duration;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
launch(app);
}

fn app() -> Element {
Expand Down
3 changes: 3 additions & 0 deletions packages/autofmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ prettyplease = { workspace = true }

[dev-dependencies]
pretty_assertions = "1.2.1"

[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
6 changes: 3 additions & 3 deletions packages/check/src/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ impl Display for IssueReport {
#[allow(clippy::enum_variant_names)] // we'll add non-hook ones in the future
/// Issues that might be found via static analysis of a Dioxus file.
pub enum Issue {
/// https://dioxuslabs.com/learn/0.5/reference/hooks#no-hooks-in-conditionals
/// <https://dioxuslabs.com/learn/0.5/reference/hooks#no-hooks-in-conditionals>
HookInsideConditional(HookInfo, ConditionalInfo),
/// https://dioxuslabs.com/learn/0.5/reference/hooks#no-hooks-in-loops
/// <https://dioxuslabs.com/learn/0.5/reference/hooks#no-hooks-in-loops>
HookInsideLoop(HookInfo, AnyLoopInfo),
/// https://dioxuslabs.com/learn/0.5/reference/hooks#no-hooks-in-closures
/// <https://dioxuslabs.com/learn/0.5/reference/hooks#no-hooks-in-closures>
HookInsideClosure(HookInfo, ClosureInfo),
HookOutsideComponent(HookInfo),
}
Expand Down
3 changes: 3 additions & 0 deletions packages/cli-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ tauri-utils = { version = "=1.5.*", optional = true }
default = ["read-config"]
cli = ["tauri-bundler", "tauri-utils", "clap", "toml", "cargo_toml"]
read-config = []

[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
3 changes: 3 additions & 0 deletions packages/config-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ mobile = []
web = []
ssr = []
liveview = []

[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
3 changes: 3 additions & 0 deletions packages/core-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ trybuild = "1.0"

[features]
default = []

[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
3 changes: 3 additions & 0 deletions packages/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ reqwest = { workspace = true}
[features]
default = []
serialize = ["serde"]

[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
Loading

0 comments on commit b3cd4fa

Please sign in to comment.