Skip to content

Commit 0a3cad3

Browse files
committed
Adds a short snippet of documentation for RawRef and some top-level bullets on the new types
1 parent 3888399 commit 0a3cad3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/lib.rs

+16
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@
2929
//! dimensions, then an element in the array is accessed by using that many indices.
3030
//! Each dimension is also called an *axis*.
3131
//!
32+
//! To get started, functionality is provided in the following core types:
3233
//! - **[`ArrayBase`]**:
3334
//! The *n*-dimensional array type itself.<br>
3435
//! It is used to implement both the owned arrays and the views; see its docs
3536
//! for an overview of all array features.<br>
3637
//! - The main specific array type is **[`Array`]**, which owns
3738
//! its elements.
39+
//! - A reference type, **[`ArrayRef`]**, that contains most of the functionality
40+
//! for reading and writing to arrays.
41+
//! - A reference type, **[`LayoutRef`]**, that contains most of the functionality
42+
//! for reading and writing to array layouts: their shape and strides.
3843
//!
3944
//! ## Highlights
4045
//!
@@ -1473,6 +1478,17 @@ pub struct LayoutRef<A, D>
14731478
#[repr(transparent)]
14741479
pub struct ArrayRef<A, D>(LayoutRef<A, D>);
14751480

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

0 commit comments

Comments
 (0)