This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LaoLittle
committed
Jan 3, 2023
1 parent
b2ba467
commit a592dc8
Showing
9 changed files
with
67 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
use std::path::{Path, PathBuf}; | ||
|
||
pub mod login; | ||
pub mod plugin; | ||
|
||
const SERVICE_CONFIG_PATH: &str = "service"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// 对插件产生错误的态度 | ||
#[derive(Serialize, Deserialize, Default)] | ||
pub enum FaultAttitude { | ||
#[default] | ||
/// 立即结束程序, 记录堆栈 | ||
FastFault, | ||
/// 忽略错误, 关闭产生错误的监听器, 记录堆栈 | ||
/// | ||
/// 可能导致内存泄露或其他问题 | ||
Ignore, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use atri_ffi::{RustStr, RustString}; | ||
use std::ffi::{c_char, CStr, CString}; | ||
use std::ptr::null_mut; | ||
|
||
pub extern "C" fn rust_str_cvt(str: RustStr) -> *mut c_char { | ||
let str = str.as_str(); | ||
CString::new(str) | ||
.map(CString::into_raw) | ||
.unwrap_or(null_mut()) | ||
} | ||
|
||
pub extern "C" fn c_str_cvt(ptr: *const c_char) -> RustString { | ||
let cstr = unsafe { CStr::from_ptr(ptr) }; | ||
|
||
cstr.to_string_lossy().to_string().into() | ||
} | ||
|
||
pub extern "C" fn rust_string_drop(str: RustString) { | ||
drop(String::from(str)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters