From d9c28d109c50816354455179fa6ca57ea8873f2c Mon Sep 17 00:00:00 2001 From: Francisco Noel <63328653+byfnoel@users.noreply.github.com> Date: Sun, 28 Apr 2024 18:57:03 -0400 Subject: [PATCH 1/2] fmt --- src/heap.rs | 14 +++++++------- src/lib.rs | 8 ++++---- src/rsalloc.rs | 3 +-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/heap.rs b/src/heap.rs index 69fc415..f7e0f54 100644 --- a/src/heap.rs +++ b/src/heap.rs @@ -1,4 +1,4 @@ -/* +/* | embed Heap | 文件名称: heap.rs | 文件作用: C程序的包装 @@ -34,16 +34,16 @@ //! wrapper for C implement /// # Allocate memory -/// +/// /// Allocate memory in heap. -/// +/// /// ## Arguments -/// +/// /// * `size`: need size, bytes /// * `align`: memory alignment, bytes -/// +/// /// ## Return Value -/// +/// /// If succeeded, this function will return the start pointer for the block, /// and if failed, it will return `None`. pub fn allocate(size: usize, align: usize) -> Option<*mut u8> { @@ -61,7 +61,7 @@ pub fn free(ptr: *mut u8) { } /// # Initialize heap -/// +/// /// Initialize heap, it will initialize the free list in heap memory. pub fn init() { unsafe { emheap_impl_Heap_Init() }; diff --git a/src/lib.rs b/src/lib.rs index f04dea5..b9feb56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,17 +32,17 @@ OTHER DEALINGS IN THE SOFTWARE. */ //! # emheap -//! +//! //! The `emheap` crate is a very simple memory manager for embedded systems and microprocessors. -//! +//! //! Here are the main features: -//! +//! //! 1. small: total no more than 350 lines of code. //! 2. fragmentation collection: //! the programming will merge the closest memory block to avoid fragmentation. //! 3. cross-platform: it does not rely on any libraries. //! 4. memory alignment: support memory alignment. -//! +//! //! WARNING: **DO NOT** use this library on your PC. //! #![cfg_attr(not(test), no_std)] diff --git a/src/rsalloc.rs b/src/rsalloc.rs index 312b900..b2f08a4 100644 --- a/src/rsalloc.rs +++ b/src/rsalloc.rs @@ -1,4 +1,4 @@ -/* +/* | embed Heap | 文件名称: rsalloc.rs | 文件作用: Rust的分配器实现 @@ -53,4 +53,3 @@ unsafe impl GlobalAlloc for Allocator { heap::free(ptr); } } - From ef3dbd25235e651929d05df2a535d6bd89f4c881 Mon Sep 17 00:00:00 2001 From: Francisco Noel <63328653+byfnoel@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:07:06 -0400 Subject: [PATCH 2/2] Rename cargo.toml to Cargo.toml Previously, this crate was only available on crates.io and not on docs.rs. With this change, this crate would be available on both. See [this issue](https://github.com/rust-lang/docs.rs/issues/2491) on the [https://github.com/rust-lang/docs.rs] repo for reference. --- cargo.toml => Cargo.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cargo.toml => Cargo.toml (100%) diff --git a/cargo.toml b/Cargo.toml similarity index 100% rename from cargo.toml rename to Cargo.toml