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

This commit is contained in:
Lucas Fernandes Nogueira 2021-08-13 11:40:57 -03:00 committed by GitHub
parent 6cd640fa0a
commit b85775911d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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