Skip to content

Commit

Permalink
refactor(tauri): expose all items meant to be public (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
chippers committed Apr 11, 2021
1 parent 863dd87 commit 7fab1c0
Show file tree
Hide file tree
Showing 21 changed files with 677 additions and 630 deletions.
4 changes: 2 additions & 2 deletions core/tauri-codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ use quote::quote;
use std::path::PathBuf;
use tauri_api::config::Config;

/// Necessary data needed by [`codegen_context`] to generate code for a Tauri application context.
/// Necessary data needed by [`context_codegen`] to generate code for a Tauri application context.
pub struct ContextData {
pub dev: bool,
pub config: Config,
pub config_parent: PathBuf,
pub context_path: TokenStream,
}

/// Build an `AsTauriContext` implementation for including in application code.
/// Build a `tauri::Context` for including in application code.
pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsError> {
let ContextData {
dev,
Expand Down
13 changes: 1 addition & 12 deletions core/tauri-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,7 @@ pub fn generate_handler(item: TokenStream) -> TokenStream {
gen.into()
}

/// Reads a Tauri config file and generates an [`AsTauriContext`] based on the content.
///
/// The default config file path is a `tauri.conf.json` file inside the Cargo manifest directory of
/// the crate being built.
///
/// # Custom Config Path
///
/// You may pass a string literal to this macro to specify a custom path for the Tauri config file.
/// If the path is relative, it will be search for relative to the Cargo manifest of the compiling
/// crate.
///
/// todo: link the [`AsTauriContext`] docs
/// Reads a Tauri config file and generates a `::tauri::Context` based on the content.
#[proc_macro]
pub fn generate_context(items: TokenStream) -> TokenStream {
// this macro is exported from the context module
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::{
api::{config::Config, PackageInfo},
hooks::InvokeMessage,
runtime::Params,
Params,
};
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
Expand Down
5 changes: 1 addition & 4 deletions core/tauri/src/endpoints/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use crate::{
endpoints::InvokeResponse,
runtime::{sealed::ManagerPrivate, window::Window, Manager, Params},
};
use crate::{endpoints::InvokeResponse, sealed::ManagerPrivate, Manager, Params, Window};
use serde::Deserialize;

/// The API descriptor.
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/endpoints/global_shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT

use super::InvokeResponse;
use crate::runtime::{window::Window, Dispatch, Params};
use crate::{runtime::Dispatch, Params, Window};
use once_cell::sync::Lazy;
use serde::Deserialize;
use std::sync::{Arc, Mutex};
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/endpoints/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT

use super::InvokeResponse;
use crate::{runtime::window::Window, Params};
use crate::{Params, Window};
use serde::Deserialize;

/// The API descriptor.
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/endpoints/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
rpc::format_callback,
},
endpoints::InvokeResponse,
runtime::{window::Window, Params},
Params, Window,
};
use once_cell::sync::Lazy;
use serde::Deserialize;
Expand Down
13 changes: 5 additions & 8 deletions core/tauri/src/endpoints/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
// SPDX-License-Identifier: MIT

use crate::{
endpoints::InvokeResponse,
runtime::{
webview::{Icon, WindowConfig},
window::{PendingWindow, Window},
Manager, Params,
},
api::config::WindowConfig, endpoints::InvokeResponse, runtime::window::PendingWindow, Manager,
Params, Window,
};
use serde::Deserialize;

use crate::Icon;
use std::path::PathBuf;

#[derive(Deserialize)]
Expand All @@ -35,7 +32,7 @@ impl Into<Icon> for IconDto {
#[serde(tag = "cmd", rename_all = "camelCase")]
pub enum Cmd {
CreateWebview {
options: crate::api::config::WindowConfig,
options: WindowConfig,
},
SetResizable {
resizable: bool,
Expand Down Expand Up @@ -123,7 +120,7 @@ impl Cmd {
});

let url = options.url.clone();
let pending = PendingWindow::new(WindowConfig(options), label.clone(), url);
let pending = PendingWindow::with_config(options, label.clone(), url);
window.create_window(pending)?.emit_others_internal(
"tauri://window-created".to_string(),
Some(WindowCreatedEvent {
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

/// The plugin error type.
/// Runtime errors that can happen inside a Tauri application.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Failed to create webview.
Expand Down
3 changes: 2 additions & 1 deletion core/tauri/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

use crate::{
api::rpc::{format_callback, format_callback_result},
runtime::{app::App, window::Window, Params},
runtime::app::App,
Params, Window,
};
use serde::{Deserialize, Serialize};
use std::future::Future;
Expand Down

0 comments on commit 7fab1c0

Please sign in to comment.