diff --git a/Cargo.toml b/Cargo.toml index 0cd5420..b18cd82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "align" -version = "0.1.0" +name = "aligners" +version = "0.0.1" authors = ["Mateusz Gienieczko "] edition = "2021" description = "Utilities for alignment guarantees for data." diff --git a/README.md b/README.md index a92b221..69ac8d7 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# `align` – strongly typed memory alignment guarantees +# `aligners` – strongly typed memory alignment guarantees -[![Rust](https://github.com/V0ldek/align/actions/workflows/rust.yml/badge.svg)](https://github.com/V0ldek/align/actions/workflows/rust.yml) +[![Rust](https://github.com/V0ldek/aligner/actions/workflows/rust.yml/badge.svg)](https://github.com/V0ldek/aligners/actions/workflows/rust.yml) Some bytes just need to be aligned. Want to process bytes in batches of $8$ by interpreting them as `u64`? They must be $8$-byte aligned. Want to run SIMD operations on your bytes? You need to use special unaligned instructions and risk performance, or align them with target's requirements. Maybe your high-performance algorithm requires page alignment? -Validating that something is aligned is hard. `align` solves this problem by introducing strongly typed alignment types. To have your bytes aligned to a page boundary on the target architecture, all you need to do is: +Validating that something is aligned is hard. `aligners` solves this problem by introducing strongly typed alignment types. To have your bytes aligned to a page boundary on the target architecture, all you need to do is: ```rust -use align::{alignment, AlignedBytes}; +use aligners::{alignment, AlignedBytes}; let bytes: [u8; 8] = [ 1, 2, 3, 4, 5, 6, 7, 8 ]; let aligned: AlignedBytes = bytes.into(); @@ -34,7 +34,7 @@ Dependencies graph generated by `cargo-deps`: Or as the output of `cargo tree`: ```plain -align v0.1.0 +aligners v0.0.1 ├── cfg-if v1.0.0 ├── lazy_static v1.4.0 └── page_size v0.4.2 @@ -57,6 +57,6 @@ It is recommended to always use [cargo-crev](https://github.com/crev-dev/cargo-c To add me to your WoT trust my crev-proof repo: -``` +```plain cargo crev trust id https://github.com/V0ldek/crev-proofs ``` diff --git a/src/alignment.rs b/src/alignment.rs index e230f27..a08f59e 100644 --- a/src/alignment.rs +++ b/src/alignment.rs @@ -19,7 +19,7 @@ pub unsafe trait Alignment { /// /// # Examples /// ```rust -/// use align::alignment::{self, Alignment}; +/// use aligners::alignment::{self, Alignment}; /// /// assert_eq!(1, alignment::One::size()); /// ``` @@ -34,7 +34,7 @@ pub struct One {} /// # Examples /// ```rust /// use page_size; -/// use align::alignment::{self, Alignment}; +/// use aligners::alignment::{self, Alignment}; /// /// assert_eq!(page_size::get(), alignment::Page::size()); /// ``` diff --git a/src/alignment/simd.rs b/src/alignment/simd.rs index bfa7b1d..32f6faf 100644 --- a/src/alignment/simd.rs +++ b/src/alignment/simd.rs @@ -25,7 +25,7 @@ pub struct SimdBlock {} /// # Examples #[cfg_attr(not(feature = "simd"), doc = "```ignore")] #[cfg_attr(feature = "simd", doc = "```")] -/// use align::alignment::{self, Alignment}; +/// use aligners::alignment::{self, Alignment}; /// /// assert_eq!(2 * alignment::SimdBlock::size(), alignment::TwoSimdBlocks::size()); /// ``` diff --git a/src/bytes.rs b/src/bytes.rs index 136f914..e1199db 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -86,7 +86,7 @@ impl AlignedBytes { /// /// # Examples /// ```rust - /// # use align::{Aligned, AlignedBytes, alignment::{self, Alignment}}; + /// # use aligners::{Aligned, AlignedBytes, alignment::{self, Alignment}}; /// let aligned = AlignedBytes::::new_initialize(8, |i| { (i % 2) as u8 }); /// let ptr = aligned.as_ptr(); /// diff --git a/src/lib.rs b/src/lib.rs index dfd52d0..4ebcc1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,11 +32,11 @@ //! # Examples //! //! ``` -//! # use align::{alignment::{self, Alignment}}; +//! # use aligners::{alignment::{self, Alignment}}; //! assert_eq!(page_size::get(), alignment::Page::size()); //! ``` //! ``` -//! # use align::{Aligned, AlignedBytes, alignment::{self, Alignment}}; +//! # use aligners::{Aligned, AlignedBytes, alignment::{self, Alignment}}; //! let possibly_unaligned = [1, 2, 3]; //! let aligned = AlignedBytes::::from(possibly_unaligned); //! let ptr = aligned.as_ptr(); @@ -48,7 +48,7 @@ //! To create a new aligned block of bytes it's easiest to use [`new_zeroed`](`AlignedBytes::new_zeroed`). //! //! ``` -//! # use align::{Aligned, AlignedBytes, alignment::{self, Alignment}}; +//! # use aligners::{Aligned, AlignedBytes, alignment::{self, Alignment}}; //! let aligned = AlignedBytes::::new_zeroed(1024); //! let ptr = aligned.as_ptr(); //! @@ -61,7 +61,7 @@ //! if you immediately want to initialize the memory afterwards. //! //! ``` -//! # use align::{Aligned, AlignedBytes, alignment::{self, Alignment}}; +//! # use aligners::{Aligned, AlignedBytes, alignment::{self, Alignment}}; //! let mut aligned = unsafe { AlignedBytes::::new(1024) }; //! let ptr = aligned.as_ptr(); //! @@ -83,7 +83,7 @@ //! that initializes all bytes with a function of their index. //! //! ``` -//! # use align::{Aligned, AlignedBytes, alignment::{self, Alignment}}; +//! # use aligners::{Aligned, AlignedBytes, alignment::{self, Alignment}}; //! let aligned = AlignedBytes::::new_initialize(8, |i| { i as u8 }); //! let ptr = aligned.as_ptr(); //! @@ -98,7 +98,7 @@ //! #![cfg_attr(not(feature = "simd"), doc = "```ignore")] #![cfg_attr(feature = "simd", doc = "```")] -//! # use align::{Aligned, AlignedBytes, alignment::{self, Alignment}}; +//! # use aligners::{Aligned, AlignedBytes, alignment::{self, Alignment}}; //! let possibly_unaligned = [1, 2, 3]; //! let aligned = AlignedBytes::::from(possibly_unaligned); //! let ptr = aligned.as_ptr();