Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an array reference type #1440

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
99722fa
Adds an array reference type.
akern40 Oct 4, 2024
44079cc
Adds some documentation
akern40 Oct 4, 2024
3d32c08
Fixes some CI/CD issues
akern40 Oct 5, 2024
8bf86df
More CI/CD fixes
akern40 Oct 5, 2024
dda4b66
Last CI/CD fix?
akern40 Oct 5, 2024
3c75150
Switches to the "same-repr" approach to allow array views to still be…
akern40 Oct 6, 2024
28fea66
Changes back to Copy-capable ArrayBase and unchanged ArrayBase internals
akern40 Oct 6, 2024
3a180c1
Removes unused import
akern40 Oct 6, 2024
6b64678
Introduces LayoutRef and starts to move functionality from ArrayBase …
akern40 Oct 11, 2024
4c440a8
Working version of the conversion to reference types
akern40 Oct 13, 2024
c183903
Uses a new design with two reference types
akern40 Oct 13, 2024
476dac5
Satisfying CI/CD
akern40 Oct 13, 2024
68d6f53
Adds Index, equality, IntoIterator, and Hash traits, plus approximates
akern40 Oct 13, 2024
2fde998
Finishes conversions of all possible ArrayBase impls to ArrayRef
akern40 Oct 14, 2024
d63d26e
Satisfying CI/CD
akern40 Oct 14, 2024
b7281f5
Adds some aliases to avoid breaking changes, and adds an example of h…
akern40 Oct 14, 2024
663e2f9
Adds Borrow and ToOwned
akern40 Oct 14, 2024
5204f68
Tests that the *Assign operators work for slices via deref
akern40 Oct 14, 2024
6a3d131
Somehow missed a `use` for `ToOwned`
akern40 Oct 14, 2024
289130d
Implicitly use deref
akern40 Oct 14, 2024
db52eab
Adds documentation and aliases for `LayoutRef`
akern40 Oct 20, 2024
2b34bf8
Fixes doc links
akern40 Oct 20, 2024
a40307b
Adds formatting for ArrayRef
akern40 Oct 20, 2024
5adbb31
Change some examples over to ArrayRef
akern40 Oct 20, 2024
6e61e83
Adds missed #[repr(transparent)] for RawRef
akern40 Oct 20, 2024
0cd4334
Simplifies deref logic and avoids null check
akern40 Oct 20, 2024
f77ad96
Adds documentation to ArrayRef
akern40 Oct 20, 2024
3888399
Adds missing aliases to ArrayBase from RawRef and LayoutRef
akern40 Oct 21, 2024
0a3cad3
Adds a short snippet of documentation for `RawRef` and some top-level…
akern40 Oct 21, 2024
cbed837
Makes as_ref more explicit through methods on ArrayBase
akern40 Oct 26, 2024
945f70d
Restore remove_index to DataOwned
akern40 Oct 26, 2024
93dfb38
Fixes unused imports
akern40 Oct 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds a short snippet of documentation for RawRef and some top-level…
… bullets on the new types
akern40 committed Oct 21, 2024
commit 0a3cad3fc02f8e78e202d0c155ce68de92559edd
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -29,12 +29,17 @@
//! dimensions, then an element in the array is accessed by using that many indices.
//! Each dimension is also called an *axis*.
//!
//! To get started, functionality is provided in the following core types:
//! - **[`ArrayBase`]**:
//! The *n*-dimensional array type itself.<br>
//! It is used to implement both the owned arrays and the views; see its docs
//! for an overview of all array features.<br>
//! - The main specific array type is **[`Array`]**, which owns
//! its elements.
//! - A reference type, **[`ArrayRef`]**, that contains most of the functionality
//! for reading and writing to arrays.
//! - A reference type, **[`LayoutRef`]**, that contains most of the functionality
//! for reading and writing to array layouts: their shape and strides.
//!
//! ## Highlights
//!
@@ -1473,6 +1478,17 @@ pub struct LayoutRef<A, D>
#[repr(transparent)]
pub struct ArrayRef<A, D>(LayoutRef<A, D>);

/// A reference to an *n*-dimensional array whose data is not safe to read or write.
///
/// This type is similar to [`ArrayRef`] but does not guarantee that its data is safe
/// to read or write; i.e., the underlying data may come from a shared array or be otherwise
/// unsafe to dereference. This type should be used sparingly and with extreme caution;
/// most of its methods either provide pointers or return [`RawArrayView`], both of
/// which tend to be full of unsafety.
///
/// For the few times when this type is appropriate, it has the same `AsRef` semantics
/// as [`LayoutRef`]; see [its documentation on writing functions](LayoutRef#writing-functions)
/// for information on how to properly handle functionality on this type.
#[repr(transparent)]
pub struct RawRef<A, D>(LayoutRef<A, D>);