Jelajahi Sumber

[rust] Tidy core defaults and migrate docs to README

bernard 4 minggu lalu
induk
melakukan
4f154d8207

+ 0 - 0
components/rust/README_cn.md → components/rust/README_zh.md


+ 1 - 1
components/rust/core/src/api/libloading.rs

@@ -150,7 +150,7 @@ impl Library {
         let h = self.handle;
         forget(self);
         let rc = libc::dlclose(h);
-        if rc == 1 {
+        if rc == 0 {
             Ok(())
         } else {
             Err(DlError::Close(rc))

+ 1 - 1
components/rust/core/src/lib.rs

@@ -77,7 +77,7 @@ pub enum RTTError {
     FileSetLengthErr,
     FileSyncErr,
 
-    FuncUnDefine,
+    FuncUndefined,
 }
 
 pub type RTResult<T> = Result<T, RTTError>;

+ 1 - 1
components/rust/core/src/panic.rs

@@ -24,7 +24,7 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
 }
 
 #[linkage = "weak"]
-#[unsafe(no_mangle)]
+#[no_mangle]
 fn __rust_panic() -> ! {
     /* Default weak panic handler: loops forever to halt execution. */
     print!("Entered weak panic handler: system will halt.");

+ 2 - 2
components/rust/core/src/thread.rs

@@ -28,7 +28,7 @@ impl Thread {
 
     pub fn new() -> ThreadBuilder {
         ThreadBuilder {
-            th_name: "uname".into(),
+            th_name: "Unnamed".into(),
             th_stack_size: 4096,
             th_priority: 10,
             th_ticks: 10,
@@ -151,4 +151,4 @@ impl ThreadBuilder {
             func,
         )
     }
-}
+}

+ 0 - 0
components/rust/docs/1.tools/tools.md → components/rust/docs/1.tools/README.md


+ 0 - 0
components/rust/docs/1.tools/tools_cn.md → components/rust/docs/1.tools/README_zh.md


+ 0 - 0
components/rust/docs/2.applications/application.md → components/rust/docs/2.applications/README.md


+ 0 - 0
components/rust/docs/2.applications/application_cn.md → components/rust/docs/2.applications/README_zh.md


+ 0 - 0
components/rust/docs/3.components/component.md → components/rust/docs/3.components/README.md


+ 0 - 0
components/rust/docs/3.components/component_cn.md → components/rust/docs/3.components/README_zh.md


+ 0 - 0
components/rust/docs/4.modules/modules.md → components/rust/docs/4.modules/README.md


+ 0 - 0
components/rust/docs/4.modules/modules_cn.md → components/rust/docs/4.modules/README_zh.md


+ 0 - 0
components/rust/docs/5.rt-macro/rt-macros.md → components/rust/docs/5.rt-macro/README.md


+ 0 - 0
components/rust/docs/5.rt-macro/rt-macros_cn.md → components/rust/docs/5.rt-macro/README_zh.md


+ 3 - 3
components/rust/examples/modules/example_lib/src/lib.rs

@@ -11,7 +11,7 @@
 /* Bring rt-rust's println! macro into scope */ 
 use rt_rust::println;
 use core::ffi::{c_char, CStr};
-#[unsafe(no_mangle)]
+#[no_mangle]
 pub extern "C" fn rust_mylib_println(s: *const c_char) {
     if s.is_null() {
         println!("");
@@ -24,7 +24,7 @@ pub extern "C" fn rust_mylib_println(s: *const c_char) {
     }
 }
 
-#[unsafe(no_mangle)]
+#[no_mangle]
 pub extern "C" fn rust_mylib_add(a: usize, b: usize) -> usize {
     a + b
-}
+}