Skip to content

Commit

Permalink
Mention that NonNull is a NeverValueField type
Browse files Browse the repository at this point in the history
  • Loading branch information
danakj committed Sep 13, 2023
1 parent 3c3ad5f commit f655513
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions sus/ptr/nonnull.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ namespace sus::ptr {

/// A pointer wrapper which holds a never-null pointer.
///
/// A NonNull can not be implicitly created from an array, as that would throw
/// A `NonNull` can not be implicitly created from an array, as that would throw
/// away the length information. Explicitly cast to a pointer to use NonNull
/// with an array.
///
/// The NonNull type is trivially copyable and moveable.
/// The `NonNull` type is trivially copyable and moveable.
///
/// `NonNull` satisifes the [`NeverValueField`]($sus::mem::NeverValueField), so
/// [`Option<NonNull<T>>`]($sus::option::Option) has the same size as `NonNull`,
/// similar to [`Option<T&>`]($sus::option::Option).
///
/// TODO: Make a NonNullArray type? https://godbolt.org/z/3vW3xsz5h
template <class T>
Expand Down Expand Up @@ -89,13 +93,6 @@ class [[sus_trivial_abi]] NonNull {
template <class U, size_t N>
static constexpr inline NonNull from(U (&t)[N]) = delete;

/// `NonNull<T>` is `Copy`, so this is the copy constructor.
/// #[doc.overloads=ctor.copy]
NonNull(const NonNull&) = default;
/// `NonNull<T>` is `Copy`, so this is the copy assignment operator.
/// #[doc.overloads=assign.copy]
NonNull& operator=(const NonNull&) = default;

/// Gives access to the object pointed to by NonNull.
///
/// Mutable access is only given is NonNull is not const and the pointer
Expand Down
2 changes: 1 addition & 1 deletion tools/run_subdoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ out/subdoc/subdoc -p out --out docs \
--project-logo logo.png \
--project-name Subspace \
--ignore-bad-code-links \
i8_unittest
i8_unittest $*

0 comments on commit f655513

Please sign in to comment.