Skip to content

Commit 1481b45

Browse files
committed
Split Fn*Ref constructor overload docs
1 parent f40c724 commit 1481b45

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

subspace/fn/fn_ref.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,16 @@ class [[sus_trivial_abi]] FnRef<R(CallArgs...)> {
117117
}
118118

119119
/// Runs the closure.
120+
///
121+
/// #[doc.overloads=call.const]
120122
inline R operator()(CallArgs... args) const& {
121123
::sus::check(invoke_); // Catch use-after-move.
122124
return (*invoke_)(storage_, ::sus::forward<CallArgs>(args)...);
123125
}
124126

125127
/// Runs and consumes the closure.
128+
///
129+
/// #[doc.overloads=call.rvalue]
126130
inline R operator()(CallArgs... args) && {
127131
::sus::check(invoke_); // Catch use-after-move.
128132
return (*::sus::mem::replace_ptr(invoke_, nullptr))(
@@ -237,6 +241,8 @@ class [[sus_trivial_abi]] FnMutRef<R(CallArgs...)> {
237241
/// Since FnRef is callable, FnMutRef is already constructible from it, but
238242
/// this constructor avoids extra indirections being inserted when converting,
239243
/// since otherwise an extra invoker call would be introduced.
244+
///
245+
/// #[doc.overloads=ctor.fnref]
240246
constexpr FnMutRef(FnRef<R(CallArgs...)>&& o sus_lifetimebound) noexcept
241247
: storage_(o.storage_),
242248
invoke_(::sus::mem::replace_ptr(o.invoke_, nullptr)) {
@@ -268,12 +274,16 @@ class [[sus_trivial_abi]] FnMutRef<R(CallArgs...)> {
268274
}
269275

270276
/// Runs the closure.
277+
///
278+
/// #[doc.overloads=call.mut]
271279
inline R operator()(CallArgs... args) & {
272280
::sus::check(invoke_); // Catch use-after-move.
273281
return (*invoke_)(storage_, ::sus::forward<CallArgs>(args)...);
274282
}
275283

276284
/// Runs and consumes the closure.
285+
///
286+
/// #[doc.overloads=call.rvalue]
277287
inline R operator()(CallArgs... args) && {
278288
::sus::check(invoke_); // Catch use-after-move.
279289
return (*::sus::mem::replace_ptr(invoke_, nullptr))(
@@ -385,6 +395,8 @@ class [[sus_trivial_abi]] FnOnceRef<R(CallArgs...)> {
385395
/// Since FnMutRef is callable, FnOnceRef is already constructible from it,
386396
/// but this constructor avoids extra indirections being inserted when
387397
/// converting, since otherwise an extra invoker call would be introduced.
398+
///
399+
/// #[doc.overloads=ctor.fnmutref]
388400
constexpr FnOnceRef(FnMutRef<R(CallArgs...)>&& o sus_lifetimebound) noexcept
389401
: storage_(o.storage_),
390402
invoke_(::sus::mem::replace_ptr(o.invoke_, nullptr)) {
@@ -396,6 +408,8 @@ class [[sus_trivial_abi]] FnOnceRef<R(CallArgs...)> {
396408
/// Since FnRef is callable, FnOnceRef is already constructible from it, but
397409
/// this constructor avoids extra indirections being inserted when converting,
398410
/// since otherwise an extra invoker call would be introduced.
411+
///
412+
/// #[doc.overloads=ctor.fnref]
399413
constexpr FnOnceRef(FnRef<R(CallArgs...)>&& o sus_lifetimebound) noexcept
400414
: storage_(o.storage_),
401415
invoke_(::sus::mem::replace_ptr(o.invoke_, nullptr)) {

0 commit comments

Comments
 (0)