Skip to content

Commit 12642a1

Browse files
author
Ngo Iok Ui (Wu Yu Wei)
authored
doc: update doc in tauri-utils and tauri (#2435)
* Update several documentations in tauri-utils * Update a few documentation in tauri * Add change file * Update macro usage
1 parent c72e4b3 commit 12642a1

File tree

9 files changed

+41
-28
lines changed

9 files changed

+41
-28
lines changed

.changes/doc-tauri-utils.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": minor
3+
---
4+
5+
`tauri::api` no longer re-export items in `tauri-utils`. We already expose necessary items in the root of `tauri`.

core/tauri-codegen/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99
io::BufReader,
1010
path::{Path, PathBuf},
1111
};
12-
pub use tauri_utils::config::Config;
12+
use tauri_utils::config::Config;
1313
use thiserror::Error;
1414

1515
mod context;

core/tauri-utils/src/assets.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5-
//! Assets handled by Tauri during compile time and runtime.
5+
//! The Assets module allows you to read files that have been bundled by tauri
6+
//! during both compile time and runtime.
67
78
#[doc(hidden)]
89
pub use phf;

core/tauri-utils/src/config.rs

+16-7
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl Default for UpdaterConfig {
198198
#[derive(PartialEq, Deserialize, Debug, Clone, Default)]
199199
#[serde(rename_all = "camelCase")]
200200
pub struct SecurityConfig {
201-
/// Content security policy to inject to HTML files with the custom protocol.
201+
/// Content security policy to inject to HTML files with `tauri://` and other user-defined custom protocols.
202202
pub csp: Option<String>,
203203
}
204204

@@ -301,21 +301,30 @@ pub struct CliArg {
301301
pub index: Option<u64>,
302302
}
303303

304-
/// The CLI root command definition.
304+
/// The CLI command definition.
305305
#[derive(PartialEq, Deserialize, Debug, Clone)]
306306
#[serde(rename_all = "camelCase")]
307-
#[allow(missing_docs)] // TODO
308307
pub struct CliConfig {
308+
/// Command description which will be shown on the help information.
309309
pub description: Option<String>,
310+
/// Command long description which will be shown on the help information.
310311
pub long_description: Option<String>,
312+
/// Adds additional help information to be displayed in addition to auto-generated help.
313+
/// This information is displayed before the auto-generated help information.
314+
/// This is often used for header information.
311315
pub before_help: Option<String>,
316+
/// Adds additional help information to be displayed in addition to auto-generated help.
317+
/// This information is displayed after the auto-generated help information.
318+
/// This is often used to describe how to use the arguments, or caveats to be noted.
312319
pub after_help: Option<String>,
320+
/// List of arguments for the command
313321
pub args: Option<Vec<CliArg>>,
322+
/// List of subcommands of this command
314323
pub subcommands: Option<HashMap<String, CliConfig>>,
315324
}
316325

317326
impl CliConfig {
318-
/// List of args for the command
327+
/// List of arguments for the command
319328
pub fn args(&self) -> Option<&Vec<CliArg>> {
320329
self.args.as_ref()
321330
}
@@ -426,10 +435,10 @@ pub enum AppUrl {
426435
#[derive(PartialEq, Deserialize, Debug)]
427436
#[serde(rename_all = "camelCase")]
428437
pub struct BuildConfig {
429-
/// the devPath config.
438+
/// Directory path or URL to use on development. Default to `http://localhost:8080`.
430439
#[serde(default = "default_dev_path")]
431440
pub dev_path: AppUrl,
432-
/// the dist config.
441+
/// Distribution directory to use in release build. Default to `../dist`.
433442
#[serde(default = "default_dist_path")]
434443
pub dist_dir: AppUrl,
435444
/// Whether we should inject the Tauri API on `window.__TAURI__` or not.
@@ -467,7 +476,7 @@ pub struct PackageConfig {
467476
pub version: Option<String>,
468477
}
469478

470-
/// The tauri.conf.json mapper.
479+
/// The config type mapped to `tauri.conf.json`.
471480
#[derive(Debug, Default, PartialEq, Deserialize)]
472481
#[serde(rename_all = "camelCase")]
473482
pub struct Config {

core/tauri-utils/src/html.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5+
//! The module to process HTML in Tauri.
6+
57
use html5ever::{interface::QualName, namespace_url, ns, LocalName};
68
use kuchiki::{Attribute, ExpandedName, NodeRef};
79

core/tauri-utils/src/lib.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@
55
//! Tauri utility helpers
66
#![warn(missing_docs, rust_2018_idioms)]
77

8-
/// The Assets module allows you to read files that have been bundled by tauri
98
pub mod assets;
10-
/// Tauri config definition.
119
pub mod config;
12-
/// Tauri HTML processing.
1310
pub mod html;
14-
/// Platform helpers
1511
pub mod platform;
1612

17-
/// `App` package information.
13+
/// `tauri::App` package information.
1814
#[derive(Debug, Clone)]
1915
pub struct PackageInfo {
20-
/// App name.
16+
/// App name
2117
pub name: String,
22-
/// App version.
18+
/// App version
2319
pub version: String,
2420
}
2521

@@ -31,10 +27,10 @@ impl PackageInfo {
3127
}
3228
}
3329

34-
/// Result type alias using the crate's error type.
30+
/// The result type of `tauri-utils`.
3531
pub type Result<T> = std::result::Result<T, Error>;
3632

37-
/// The error types.
33+
/// The error type of `tauri-utils`.
3834
#[derive(Debug, thiserror::Error)]
3935
#[non_exhaustive]
4036
pub enum Error {
@@ -47,7 +43,7 @@ pub enum Error {
4743
/// Target triple environment error
4844
#[error("Unable to determine target-environment")]
4945
Environment,
50-
/// Tried to get resource on an unsupported platform.
46+
/// Tried to get resource on an unsupported platform
5147
#[error("Unsupported platform for reading resources")]
5248
UnsupportedPlatform,
5349
/// Get parent process error
@@ -59,7 +55,7 @@ pub enum Error {
5955
/// Get child process error
6056
#[error("Could not get child process")]
6157
ChildProcess,
62-
/// IO error.
58+
/// IO error
6359
#[error("{0}")]
6460
Io(#[from] std::io::Error),
6561
}

core/tauri-utils/src/platform.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5+
//! Platform helper functions.
6+
57
use std::{
68
env,
79
path::{PathBuf, MAIN_SEPARATOR},

core/tauri/src/api/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ pub mod shell;
2626
/// The semver API.
2727
pub mod version;
2828

29-
/// The Tauri config definition.
30-
pub use tauri_utils::config;
31-
3229
/// The CLI args interface.
3330
#[cfg(feature = "cli")]
3431
#[cfg_attr(doc_cfg, doc(cfg(feature = "cli")))]
@@ -42,6 +39,7 @@ pub use clap;
4239
#[cfg(notification_all)]
4340
pub mod notification;
4441

42+
#[doc(hidden)]
4543
pub use tauri_utils::*;
4644

4745
mod error;

core/tauri/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! The following are a list of Cargo features that can be enabled or disabled:
1212
//!
1313
//! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime.
14-
//! - **menu**: Enables application menus support.
1514
//! - **reqwest-client**: Uses `reqwest` as HTTP client on the `http` APIs. Improves performance, but increases the bundle size.
1615
//! - **cli**: Enables usage of `clap` for CLI argument parsing. Enabled by default if the `cli` config is defined on the `tauri.conf.json` file.
1716
//! - **system-tray**: Enables application system tray API. Enabled by default if the `systemTray` config is defined on the `tauri.conf.json` file.
@@ -72,10 +71,6 @@ pub use runtime::{menu::NativeImage, ActivationPolicy};
7271

7372
pub use {
7473
self::api::assets::Assets,
75-
self::api::{
76-
config::{Config, WindowUrl},
77-
PackageInfo,
78-
},
7974
self::app::{App, AppHandle, Builder, CloseRequestApi, Event, GlobalWindowEvent, PathResolver},
8075
self::hooks::{
8176
Invoke, InvokeError, InvokeHandler, InvokeMessage, InvokeResolver, InvokeResponse, OnPageLoad,
@@ -107,6 +102,11 @@ pub use {
107102
self::window::menu::MenuEvent,
108103
};
109104

105+
pub use tauri_utils::{
106+
config::{Config, WindowUrl},
107+
PackageInfo,
108+
};
109+
110110
/// Reads the config file at compile time and generates a [`Context`] based on its content.
111111
///
112112
/// The default config file path is a `tauri.conf.json` file inside the Cargo manifest directory of

0 commit comments

Comments
 (0)