Skip to content

Commit cf740a1

Browse files
committed
Document the Output associated types
1 parent ab1abf9 commit cf740a1

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

src/add.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::{Error, OptionOperations};
1616
/// This trait is auto-implemented for [`OptionOperations`] types
1717
/// implementing `Add<Rhs>`.
1818
pub trait OptionAdd<Rhs, InnerRhs = Rhs> {
19+
/// The resulting inner type after applying the operation.
1920
type Output;
2021

2122
/// Computes the addition.
@@ -191,6 +192,7 @@ where
191192
/// Note that since the `std` library doesn't define any `CheckedAdd` trait,
192193
/// users must provide the base implementation for the inner type.
193194
pub trait OptionCheckedAdd<Rhs = Self, InnerRhs = Rhs> {
195+
/// The resulting inner type after applying the operation.
194196
type Output;
195197

196198
/// Computes the checked addition.
@@ -313,6 +315,7 @@ impl OptionCheckedAdd<std::time::Duration> for std::time::SystemTime {
313315
/// Note that since the `std` library doesn't define any `OverflowingAdd`
314316
/// trait, users must provide the base implementation for the inner type.
315317
pub trait OptionOverflowingAdd<Rhs = Self, InnerRhs = Rhs> {
318+
/// The resulting inner type after applying the operation.
316319
type Output;
317320

318321
/// Returns a tuple of the addition along with a boolean indicating
@@ -403,6 +406,7 @@ impl_for_ints!(OptionOverflowingAdd, {
403406
/// Note that since the `std` library doesn't define any `SaturatingAdd`
404407
/// trait, users must provide the base implementation for the inner type.
405408
pub trait OptionSaturatingAdd<Rhs = Self, InnerRhs = Rhs> {
409+
/// The resulting inner type after applying the operation.
406410
type Output;
407411

408412
/// Computes the addition, saturating at the numeric bounds instead of
@@ -492,6 +496,7 @@ impl_for_ints_and_duration!(OptionSaturatingAdd, {
492496
/// Note that since the `std` library doesn't define any `WrappingAdd`
493497
/// trait, users must provide the base implementation for the inner type.
494498
pub trait OptionWrappingAdd<Rhs = Self, InnerRhs = Rhs> {
499+
/// The resulting inner type after applying the operation.
495500
type Output;
496501

497502
/// Computes the addition, wrapping around at the numeric bounds

src/div.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::{Error, OptionOperations};
1616
/// This trait is auto-implemented for [`OptionOperations`] types
1717
/// implementing `Div<Rhs>`.
1818
pub trait OptionDiv<Rhs, InnerRhs = Rhs> {
19+
/// The resulting inner type after applying the operation.
1920
type Output;
2021

2122
/// Computes the division.
@@ -199,6 +200,7 @@ where
199200
/// Note that since the `std` library doesn't define any `CheckedDiv` trait,
200201
/// users must provide the base implementation for the inner type.
201202
pub trait OptionCheckedDiv<Rhs = Self, InnerRhs = Rhs> {
203+
/// The resulting inner type after applying the operation.
202204
type Output;
203205

204206
/// Computes the checked division.
@@ -319,6 +321,7 @@ impl OptionCheckedDiv<u32> for core::time::Duration {
319321
/// Note that since the `std` library doesn't define any `OverflowingDiv`
320322
/// trait, users must provide the base implementation for the inner type.
321323
pub trait OptionOverflowingDiv<Rhs = Self, InnerRhs = Rhs> {
324+
/// The resulting inner type after applying the operation.
322325
type Output;
323326

324327
/// Returns a tuple of the division along with a boolean indicating
@@ -413,6 +416,7 @@ impl_for_ints!(OptionOverflowingDiv, {
413416
/// Note that since the `std` library doesn't define any `WrappingDiv`
414417
/// trait, users must provide the base implementation for the inner type.
415418
pub trait OptionWrappingDiv<Rhs = Self, InnerRhs = Rhs> {
419+
/// The resulting inner type after applying the operation.
416420
type Output;
417421

418422
/// Computes the division, wrapping around at the numeric bounds

src/mul.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::{Error, OptionOperations};
1616
/// This trait is auto-implemented for [`OptionOperations`] types
1717
/// implementing `Mul<Rhs>`.
1818
pub trait OptionMul<Rhs, InnerRhs = Rhs> {
19+
/// The resulting inner type after applying the operation.
1920
type Output;
2021

2122
/// Computes the multiplication.
@@ -191,6 +192,7 @@ where
191192
/// Note that since the `std` library doesn't define any `CheckedMul` trait,
192193
/// users must provide the base implementation for the inner type.
193194
pub trait OptionCheckedMul<Rhs = Self, InnerRhs = Rhs> {
195+
/// The resulting inner type after applying the operation.
194196
type Output;
195197

196198
/// Computes the checked multiplication.
@@ -304,6 +306,7 @@ impl OptionCheckedMul<u32> for core::time::Duration {
304306
/// Note that since the `std` library doesn't define any `OverflowingMul`
305307
/// trait, users must provide the base implementation for the inner type.
306308
pub trait OptionOverflowingMul<Rhs = Self, InnerRhs = Rhs> {
309+
/// The resulting inner type after applying the operation.
307310
type Output;
308311

309312
/// Returns a tuple of the multiplication along with a boolean indicating
@@ -394,6 +397,7 @@ impl_for_ints!(OptionOverflowingMul, {
394397
/// Note that since the `std` library doesn't define any `SaturatingMul`
395398
/// trait, users must provide the base implementation for the inner type.
396399
pub trait OptionSaturatingMul<Rhs = Self, InnerRhs = Rhs> {
400+
/// The resulting inner type after applying the operation.
397401
type Output;
398402

399403
/// Computes the multiplication, saturating at the numeric bounds instead of
@@ -490,6 +494,7 @@ impl OptionSaturatingMul<u32> for core::time::Duration {
490494
/// Note that since the `std` library doesn't define any `WrappingMul`
491495
/// trait, users must provide the base implementation for the inner type.
492496
pub trait OptionWrappingMul<Rhs = Self, InnerRhs = Rhs> {
497+
/// The resulting inner type after applying the operation.
493498
type Output;
494499

495500
/// Computes the multiplication, wrapping around at the numeric bounds

src/rem.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::{Error, OptionOperations};
1616
/// This trait is auto-implemented for [`OptionOperations`] types
1717
/// implementing `Rem<Rhs>`.
1818
pub trait OptionRem<Rhs, InnerRhs = Rhs> {
19+
/// The resulting inner type after applying the operation.
1920
type Output;
2021

2122
/// Computes the remainder.
@@ -199,6 +200,7 @@ where
199200
/// Note that since the `std` library doesn't define any `CheckedRem` trait,
200201
/// users must provide the base implementation for the inner type.
201202
pub trait OptionCheckedRem<Rhs = Self, InnerRhs = Rhs> {
203+
/// The resulting inner type after applying the operation.
202204
type Output;
203205

204206
/// Computes the checked remainder.
@@ -309,6 +311,7 @@ impl_for_ints!(OptionCheckedRem, {
309311
/// Note that since the `std` library doesn't define any `OverflowingRem`
310312
/// trait, users must provide the base implementation for the inner type.
311313
pub trait OptionOverflowingRem<Rhs = Self, InnerRhs = Rhs> {
314+
/// The resulting inner type after applying the operation.
312315
type Output;
313316

314317
/// Returns a tuple of the remainder along with a boolean indicating
@@ -403,6 +406,7 @@ impl_for_ints!(OptionOverflowingRem, {
403406
/// Note that since the `std` library doesn't define any `WrappingRem`
404407
/// trait, users must provide the base implementation for the inner type.
405408
pub trait OptionWrappingRem<Rhs = Self, InnerRhs = Rhs> {
409+
/// The resulting inner type after applying the operation.
406410
type Output;
407411

408412
/// Computes the remainder, wrapping around at the numeric bounds

src/sub.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::{Error, OptionOperations};
1616
/// This trait is auto-implemented for [`OptionOperations`] types
1717
/// implementing `Sub<Rhs>`.
1818
pub trait OptionSub<Rhs, InnerRhs = Rhs> {
19+
/// The resulting inner type after applying the operation.
1920
type Output;
2021

2122
/// Computes the substraction.
@@ -191,6 +192,7 @@ where
191192
/// Note that since the `std` library doesn't define any `CheckedSub` trait,
192193
/// users must provide the base implementation for the inner type.
193194
pub trait OptionCheckedSub<Rhs = Self, InnerRhs = Rhs> {
195+
/// The resulting inner type after applying the operation.
194196
type Output;
195197

196198
/// Computes the checked substraction.
@@ -313,6 +315,7 @@ impl OptionCheckedSub<std::time::Duration> for std::time::SystemTime {
313315
/// Note that since the `std` library doesn't define any `OverflowingSub`
314316
/// trait, users must provide the base implementation for the inner type.
315317
pub trait OptionOverflowingSub<Rhs = Self, InnerRhs = Rhs> {
318+
/// The resulting inner type after applying the operation.
316319
type Output;
317320

318321
/// Returns a tuple of the substraction along with a boolean indicating
@@ -403,6 +406,7 @@ impl_for_ints!(OptionOverflowingSub, {
403406
/// Note that since the `std` library doesn't define any `SaturatingSub`
404407
/// trait, users must provide the base implementation for the inner type.
405408
pub trait OptionSaturatingSub<Rhs = Self, InnerRhs = Rhs> {
409+
/// The resulting inner type after applying the operation.
406410
type Output;
407411

408412
/// Computes the substraction, saturating at the numeric bounds instead of
@@ -492,6 +496,7 @@ impl_for_ints_and_duration!(OptionSaturatingSub, {
492496
/// Note that since the `std` library doesn't define any `WrappingSub`
493497
/// trait, users must provide the base implementation for the inner type.
494498
pub trait OptionWrappingSub<Rhs = Self, InnerRhs = Rhs> {
499+
/// The resulting inner type after applying the operation.
495500
type Output;
496501

497502
/// Computes the substraction, wrapping around at the numeric bounds

0 commit comments

Comments
 (0)