lib.rs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2006-2025, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author notes
  8. * 2025-09-15 foxglove 1.0 version
  9. * 2025-09-25 foxglove 1.1 version
  10. * 2025-10-10 foxglove latest version
  11. */
  12. /* RT-Thread Rust core library
  13. Provides basic system support functionality including file system, network,
  14. and device interfaces. Designed for embedded devices running RT-Thread.
  15. */
  16. #![no_std]
  17. #![feature(alloc_error_handler)]
  18. #![feature(linkage)]
  19. #![allow(dead_code)]
  20. pub extern crate alloc;
  21. #[doc = "Alloc by rt-thread"]
  22. #[global_allocator]
  23. static GLOBAL: allocator::RttAlloc = allocator::RttAlloc;
  24. pub mod api;
  25. pub mod bindings;
  26. pub mod init;
  27. pub mod allocator;
  28. pub mod mutex;
  29. pub mod out;
  30. pub mod fs;
  31. pub mod panic;
  32. pub mod param;
  33. pub mod queue;
  34. pub mod sem;
  35. pub mod thread;
  36. pub mod time;
  37. pub mod libloader;
  38. mod prelude;
  39. pub use prelude::v1::*;
  40. /* Re-export initialization function */
  41. pub use init::rust_init;
  42. #[derive(Debug, Copy, Clone, Eq, PartialEq)]
  43. pub enum RTTError {
  44. ThreadStartupErr,
  45. MutexTakeTimeout,
  46. SemaphoreTakeTimeout,
  47. QueueSendTimeout,
  48. QueueReceiveTimeout,
  49. OutOfMemory,
  50. DeviceNotFound,
  51. DeviceOpenFailed,
  52. DeviceCloseFailed,
  53. DeviceReadFailed,
  54. DeviceWriteFailed,
  55. DeviceTransFailed,
  56. DeviceConfigFailed,
  57. DeviceSetRxCallBackFailed,
  58. DeviceSetTxCallBackFailed,
  59. FileOpenErr,
  60. FileCloseErr,
  61. FileReadErr,
  62. FileWriteErr,
  63. FileSeekErr,
  64. FileFlushErr,
  65. FileDeleteErr,
  66. FileSetLengthErr,
  67. FileSyncErr,
  68. FuncUndefined,
  69. }
  70. pub type RTResult<T> = Result<T, RTTError>;