TauriでのRustとTypeScript間での値の受け渡し(struct)
Rust側
Rust側から値を渡すときは構造体にして渡す
const returnResult: string = await invoke("execute_git_cmd", {
command : {
addFilePatha: command.stateCommand.addFilePath,
commitMsg: command.stateCommand.commitMsg,
selectBranch: command.stateCommand.selectBranch
}
});TS側
TS側はtypeで型エイリアスを定義する。
type command = {
addFilePath : string,
commitMsg: string,
selectBranch: string
}