remove tauri-src
4
app/src-tauri/.gitignore
vendored
@ -1,4 +0,0 @@
|
|||||||
# Generated by Cargo
|
|
||||||
# will have compiled files and executables
|
|
||||||
/target/
|
|
||||||
|
|
5250
app/src-tauri/Cargo.lock
generated
@ -1,26 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tauri-app"
|
|
||||||
version = "0.0.0"
|
|
||||||
description = "A Tauri App"
|
|
||||||
authors = ["you"]
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "tauri_app_lib"
|
|
||||||
crate-type = ["lib", "cdylib"]
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
tauri-build = { version = "2.0.0-beta", features = [] }
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tauri = { version = "2.0.0-beta", features = [] }
|
|
||||||
tauri-plugin-shell = "2.0.0-beta"
|
|
||||||
serde_json = "1.0"
|
|
||||||
wasmtime = "18.0.1"
|
|
||||||
|
|
||||||
[features]
|
|
||||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
|
||||||
# DO NOT REMOVE!!
|
|
||||||
custom-protocol = ["tauri/custom-protocol"]
|
|
@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
tauri_build::build()
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
{}
|
|
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 974 B |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 903 B |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,5 +0,0 @@
|
|||||||
(module
|
|
||||||
(func (export "answer") (result i32)
|
|
||||||
i32.const 42
|
|
||||||
)
|
|
||||||
)
|
|
@ -1,80 +0,0 @@
|
|||||||
use std::env;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use wasmtime::*;
|
|
||||||
|
|
||||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
|
||||||
#[tauri::command]
|
|
||||||
fn greet(name: &str) -> String {
|
|
||||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
fn insult(name: &str) -> String {
|
|
||||||
format!("Hello, {}! Fuck you from Rust!", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_current_working_dir() -> std::io::Result<PathBuf> {
|
|
||||||
env::current_dir()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
fn run_nodes() -> Result<i32, String> {
|
|
||||||
// An engine stores and configures global compilation settings like
|
|
||||||
// optimization level, enabled wasm features, etc.
|
|
||||||
let engine = Engine::default();
|
|
||||||
|
|
||||||
let pwd = get_current_working_dir().expect("Cant get wkring dir");
|
|
||||||
println!(
|
|
||||||
"{}",
|
|
||||||
pwd.into_os_string().into_string().expect("cant unwrap")
|
|
||||||
);
|
|
||||||
|
|
||||||
// We start off by creating a `Module` which represents a compiled form
|
|
||||||
// of our input wasm module. In this case it'll be JIT-compiled after
|
|
||||||
// we parse the text format.
|
|
||||||
let module =
|
|
||||||
Module::from_file(&engine, "src/hello.wat").expect("Could not instatiate hello.wat");
|
|
||||||
|
|
||||||
// A `Store` is what will own instances, functions, globals, etc. All wasm
|
|
||||||
// items are stored within a `Store`, and it's what we'll always be using to
|
|
||||||
// interact with the wasm world. Custom data can be stored in stores but for
|
|
||||||
// now we just use `()`.
|
|
||||||
let mut store = Store::new(&engine, ());
|
|
||||||
|
|
||||||
// With a compiled `Module` we can then instantiate it, creating
|
|
||||||
// an `Instance` which we can actually poke at functions on.
|
|
||||||
let instance = Instance::new(&mut store, &module, &[]).expect("Could not instatiate module");
|
|
||||||
|
|
||||||
// The `Instance` gives us access to various exported functions and items,
|
|
||||||
// which we access here to pull out our `answer` exported function and
|
|
||||||
// run it.
|
|
||||||
let answer = instance
|
|
||||||
.get_func(&mut store, "answer")
|
|
||||||
.expect("`answer` was not an exported function");
|
|
||||||
|
|
||||||
// There's a few ways we can call the `answer` `Func` value. The easiest
|
|
||||||
// is to statically assert its signature with `typed` (in this case
|
|
||||||
// asserting it takes no arguments and returns one i32) and then call it.
|
|
||||||
let answer = answer
|
|
||||||
.typed::<(), i32>(&store)
|
|
||||||
.expect("Can't access answer function");
|
|
||||||
|
|
||||||
// And finally we can call our function! Note that the error propagation
|
|
||||||
// with `?` is done to handle the case where the wasm function traps.
|
|
||||||
let result = answer
|
|
||||||
.call(&mut store, ())
|
|
||||||
.expect("Could not call function");
|
|
||||||
println!("Answer: {:?}", result);
|
|
||||||
|
|
||||||
Ok(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
||||||
pub fn run() {
|
|
||||||
tauri::Builder::default()
|
|
||||||
.plugin(tauri_plugin_shell::init())
|
|
||||||
.invoke_handler(tauri::generate_handler![greet, run_nodes, insult])
|
|
||||||
.run(tauri::generate_context!())
|
|
||||||
.expect("error while running tauri application");
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
tauri_app_lib::run()
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
"productName": "tauri-app",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"identifier": "nodes.max.richter.dev",
|
|
||||||
"build": {
|
|
||||||
"beforeDevCommand": "pnpm dev",
|
|
||||||
"devUrl": "http://localhost:5173",
|
|
||||||
"beforeBuildCommand": "pnpm build",
|
|
||||||
"frontendDist": "../build"
|
|
||||||
},
|
|
||||||
"app": {
|
|
||||||
"windows": [
|
|
||||||
{
|
|
||||||
"title": "tauri-app",
|
|
||||||
"width": 800,
|
|
||||||
"height": 600
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"security": {
|
|
||||||
"csp": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"bundle": {
|
|
||||||
"active": true,
|
|
||||||
"targets": "all",
|
|
||||||
"icon": [
|
|
||||||
"icons/32x32.png",
|
|
||||||
"icons/128x128.png",
|
|
||||||
"icons/128x128@2x.png",
|
|
||||||
"icons/icon.icns",
|
|
||||||
"icons/icon.ico"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|