Forráskód Böngészése

feat(docs): improve feature-specific API documentation (#2418)

Lucas Fernandes Nogueira 4 éve
szülő
commit
b85775911d

+ 1 - 0
core/tauri-build/src/lib.rs

@@ -12,6 +12,7 @@ use std::path::{Path, PathBuf};
 mod codegen;
 
 #[cfg(feature = "codegen")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "codegen")))]
 pub use codegen::context::CodegenContext;
 
 /// Attributes used on Windows.

+ 3 - 0
core/tauri/src/api/error.rs

@@ -30,6 +30,7 @@ pub enum Error {
   Network(#[from] attohttpc::Error),
   /// The network error.
   #[cfg(feature = "reqwest-client")]
+  #[cfg_attr(doc_cfg, doc(cfg(feature = "reqwest-client")))]
   #[error("Network Error: {0}")]
   Network(#[from] reqwest::Error),
   /// HTTP method error.
@@ -37,6 +38,7 @@ pub enum Error {
   HttpMethod(#[from] http::method::InvalidMethod),
   /// Invalid HTTP header value.
   #[cfg(feature = "reqwest-client")]
+  #[cfg_attr(doc_cfg, doc(cfg(feature = "reqwest-client")))]
   #[error("{0}")]
   HttpHeaderValue(#[from] http::header::InvalidHeaderValue),
   /// Invalid HTTP header value.
@@ -75,6 +77,7 @@ pub enum Error {
   FailedToDetectPlatform(String),
   /// CLI argument parsing error.
   #[cfg(feature = "cli")]
+  #[cfg_attr(doc_cfg, doc(cfg(feature = "cli")))]
   #[error("failed to parse CLI arguments: {0}")]
   ParseCliArguments(#[from] clap::Error),
   /// Shell error.

+ 2 - 0
core/tauri/src/api/mod.rs

@@ -31,9 +31,11 @@ pub use tauri_utils::config;
 
 /// The CLI args interface.
 #[cfg(feature = "cli")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "cli")))]
 pub mod cli;
 
 #[cfg(feature = "cli")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "cli")))]
 pub use clap;
 
 /// The desktop notifications API module.

+ 1 - 0
core/tauri/src/app.rs

@@ -1016,6 +1016,7 @@ fn on_event_loop_event<R: Runtime>(event: &RunEvent, manager: &WindowManager<R>)
 
 /// Make `Wry` the default `Runtime` for `Builder`
 #[cfg(feature = "wry")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "wry")))]
 impl Default for Builder<crate::Wry> {
   fn default() -> Self {
     Self::new()

+ 1 - 0
core/tauri/src/error.rs

@@ -65,6 +65,7 @@ pub enum Error {
   Setup(Box<dyn std::error::Error + Send>),
   /// Tauri updater error.
   #[cfg(feature = "updater")]
+  #[cfg_attr(doc_cfg, doc(cfg(feature = "updater")))]
   #[error("Updater: {0}")]
   TauriUpdater(#[from] crate::updater::Error),
   /// Error initializing plugin.

+ 2 - 0
core/tauri/src/lib.rs

@@ -47,9 +47,11 @@ use tauri_runtime as runtime;
 pub mod settings;
 mod state;
 #[cfg(feature = "updater")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "updater")))]
 pub mod updater;
 
 #[cfg(feature = "wry")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "wry")))]
 pub use tauri_runtime_wry::Wry;
 
 /// `Result<T, ::tauri::Error>`