Add --generate-link-to-definition in the docs of all our published crate

This is a nice nightly rustdoc feature and we should make use of it
This commit is contained in:
Olivier Goffart 2025-03-22 12:20:21 +01:00
parent a9ec6c72a7
commit c0cac46009
18 changed files with 57 additions and 7 deletions

View file

@ -23,7 +23,7 @@ jobs:
# Allow deprecated warning because we are using nightly and some things might be deprecated in nightly
# for which the stable alternative is not yet available.
RUSTFLAGS: -D warnings -W deprecated
RUSTDOCFLAGS: --html-in-header=/home/runner/work/slint/slint/docs/astro/src/utils/slint-docs-highlight.html -D warnings -W deprecated --cfg docsrs
RUSTDOCFLAGS: --html-in-header=/home/runner/work/slint/slint/docs/astro/src/utils/slint-docs-highlight.html -D warnings -W deprecated --cfg docsrs -Zunstable-options --generate-link-to-definition
SLINT_NO_QT: 1
CARGO_INCREMENTAL: false
RELEASE_INPUT: ${{ inputs.release }}

View file

@ -30,3 +30,4 @@ derive_more = { workspace = true, features = ["std", "error"] }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -27,3 +27,6 @@ i-slint-compiler = { workspace = true, features = ["default", "proc_macro_span",
proc-macro2 = "1.0.17"
quote = "1.0"
spin_on = { workspace = true }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -259,3 +259,4 @@ features = [
"raw-window-handle-06",
"unstable-wgpu-24",
]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -113,9 +113,14 @@ use crate::platform::SetPlatformError;
///
/// See also [`init_with_event_listener`]
pub fn init(app: android_activity::AndroidApp) -> Result<(), SetPlatformError> {
crate::platform::set_platform(Box::new(i_slint_backend_android_activity::AndroidPlatform::new(
app,
)))
#[cfg(not(target_os = "android"))]
unreachable!();
#[cfg(target_os = "android")]
{
crate::platform::set_platform(Box::new(
i_slint_backend_android_activity::AndroidPlatform::new(app),
))
}
}
/// Similar to [`init()`], which allow to listen to android-activity's event
@ -145,7 +150,14 @@ pub fn init_with_event_listener(
app: android_activity::AndroidApp,
listener: impl Fn(&android_activity::PollEvent<'_>) + 'static,
) -> Result<(), SetPlatformError> {
crate::platform::set_platform(Box::new(
i_slint_backend_android_activity::AndroidPlatform::new_with_event_listener(app, listener),
))
#[cfg(not(target_os = "android"))]
unreachable!();
#[cfg(target_os = "android")]
{
crate::platform::set_platform(Box::new(
i_slint_backend_android_activity::AndroidPlatform::new_with_event_listener(
app, listener,
),
))
}
}

View file

@ -39,3 +39,4 @@ android-build = "0.1.2"
[package.metadata.docs.rs]
targets = ["aarch64-linux-android", "armv7-linux-androideabi", "i686-linux-android", "x86_64-linux-android"]
features = ["native-activity", "aa-06"]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -45,3 +45,6 @@ glutin = { workspace = true, optional = true, default-features = false, features
raw-window-handle = { version = "0.6.2", optional = true }
bytemuck = { workspace = true, optional = true, features = ["derive"] }
memmap2 = { version = "0.9.4", optional = true }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -37,3 +37,6 @@ qttypes = { version = "0.2.7", default-features = false, optional = true }
[build-dependencies]
cpp_build = { version = "0.5.5", optional = true }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -82,3 +82,6 @@ i-slint-common = { workspace = true }
[dev-dependencies]
slint = { path = "../../../api/rs/slint", default-features = false, features = ["std", "compat-1-2", "backend-winit", "renderer-software", "unstable-winit-030"] }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -40,3 +40,6 @@ pb-rs = { version = "0.10.0", optional = true, default-features = false }
slint = { path = "../../../api/rs/slint", default-features = false, features = ["std", "compat-1-2"] }
i-slint-core-macros = { path = "../../core-macros" }
i-slint-common = { path = "../../common" }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -125,3 +125,4 @@ slint = { path = "../../../api/rs/slint", default-features = false, features = [
[package.metadata.docs.rs]
features = ["wayland", "renderer-software", "raw-window-handle-06"]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -34,3 +34,6 @@ fontdb = { workspace = true, optional = true, features = ["std", "fs", "fontconf
[target.'cfg(all(not(target_arch = "wasm32"), not(target_os = "nto")))'.dependencies]
fontdb = { workspace = true, optional = true, features = ["memmap"] }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -75,3 +75,6 @@ i-slint-parser-test-macro = { path = "./parser-test-macro" }
regex = "1.3.7"
spin_on = { workspace = true }
rayon = { workspace = true }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -23,3 +23,6 @@ path = "lib.rs"
quote = "1.0"
syn = { version = "2.0", features = ["full", "visit-mut"] }
serde_json = { workspace = true }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -150,3 +150,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(slint_debug_property)", "c
# Coord is an alias for f32 in most architectures, but not always, so the cast
# to f32 *is* necessary.
unnecessary_cast = { level = "allow" }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -166,3 +166,4 @@ spin_on = { workspace = true }
[package.metadata.docs.rs]
features = ["display-diagnostics", "document-features", "raw-window-handle-06"]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -56,3 +56,6 @@ core-text = { version = "21.0.0" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { workspace = true, features = ["console", "WebGlContextAttributes", "CanvasRenderingContext2d", "HtmlInputElement", "HtmlCanvasElement", "Window", "Document"] }
wasm-bindgen = { version = "0.2" }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View file

@ -76,3 +76,6 @@ skia-safe = { version = "0.86.0", features = ["gl"] }
[build-dependencies]
cfg_aliases = { workspace = true }
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]