Skip to content

Commit 4e0bcc1

Browse files
committed
Adds a short snippet of documentation for RawRef and some top-level bullets on the new types
1 parent 9c9d8c2 commit 4e0bcc1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@
3131
//! dimensions, then an element in the array is accessed by using that many indices.
3232
//! Each dimension is also called an *axis*.
3333
//!
34+
//! To get started, functionality is provided in the following core types:
3435
//! - **[`ArrayBase`]**:
3536
//! The *n*-dimensional array type itself.<br>
3637
//! It is used to implement both the owned arrays and the views; see its docs
3738
//! for an overview of all array features.<br>
3839
//! - The main specific array type is **[`Array`]**, which owns
3940
//! its elements.
41+
//! - A reference type, **[`ArrayRef`]**, that contains most of the functionality
42+
//! for reading and writing to arrays.
43+
//! - A reference type, **[`LayoutRef`]**, that contains most of the functionality
44+
//! for reading and writing to array layouts: their shape and strides.
4045
//!
4146
//! ## Highlights
4247
//!
@@ -1478,6 +1483,17 @@ pub struct LayoutRef<A, D>
14781483
#[repr(transparent)]
14791484
pub struct ArrayRef<A, D>(LayoutRef<A, D>);
14801485

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

0 commit comments

Comments
 (0)