devela/code/
ops.rs

1// devela::code::ops
2//
3//! Overloadable operators.
4//!
5#![doc = crate::doc_!(extends: ops)]
6//
7
8crate::items! { // structural access: _mods, _all, _always
9    #[allow(unused)]
10    pub use _mods::*;
11    #[allow(unused)] #[doc(hidden, no_inline)]
12    pub use _always::*;
13
14    mod _mods {
15        pub use super::reexports::*;
16    }
17    pub(super) mod _all {
18        #[doc(inline)]
19        pub use super::reexports::*;
20    }
21    pub(super) mod _always { #![allow(unused)]
22        pub use super::reexports::*;
23    }
24}
25
26mod reexports {
27    use crate::reexport;
28
29    // enums
30    reexport! { rust: core::ops,
31    doc: "An endpoint of a range of keys.\n\n See also `num::`[`Interval`][crate::Interval].",
32    Bound }
33    reexport! { rust: core::ops,
34    doc: "Used to tell an operation whether it should exit early or go on as usual.", ControlFlow }
35
36    // structs
37    reexport! { rust: core::ops,
38    doc: "A range bounded inclusively below and exclusively above (`start..end`).", Range }
39    reexport! { rust: core::ops,
40    doc: "A range only bounded inclusively below (`start..`).", RangeFrom }
41    reexport! { rust: core::ops, doc: "An unbounded range (`..`).", RangeFull }
42    reexport! { rust: core::ops,
43    doc: "A range bounded inclusively below and above (`start..=end`).", RangeInclusive }
44    reexport! { rust: core::ops,
45    doc: "A range only bounded exclusively above (`..end`).", RangeTo }
46    reexport! { rust: core::ops,
47    doc: "A range only bounded inclusively above (`..=end`).", RangeToInclusive }
48
49    // traits
50    reexport! { rust: core::ops, doc: "The addition operator `+`.", Add }
51    reexport! { rust: core::ops, doc: "The addition assignment operator `+=`.", AddAssign }
52    reexport! { rust: core::ops, doc: "The bitwise AND operator `&`.", BitAnd }
53    reexport! { rust: core::ops, doc: "The bitwise AND assignment operator `&=`.", BitAndAssign }
54    reexport! { rust: core::ops, doc: "The bitwise OR operator `|`.", BitOr }
55    reexport! { rust: core::ops, doc: "The bitwise OR assignment operator `|=`.", BitOrAssign }
56    reexport! { rust: core::ops, doc: "The bitwise XOR operator `^`.", BitXor }
57    reexport! { rust: core::ops, doc: "The bitwise XOR assignment operator `^=`.", BitXorAssign }
58    reexport! { rust: core::ops,
59    doc: "Used for immutable dereferencing operations, like `*v`.", Deref }
60    reexport! { rust: core::ops,
61    doc: "Used for mutable dereferencing operations, like in `*v = 1;`.", DerefMut }
62    reexport! { rust: core::ops, doc: "The division operator `/`.", Div }
63    reexport! { rust: core::ops, doc: "The division assignment operator `/=`.", DivAssign }
64    reexport! { rust: core::ops, doc: "Custom code within the destructor.", Drop }
65    reexport! { rust: core::ops,
66    doc: "The version of the call operator that takes an immutable receiver.", Fn }
67    reexport! { rust: core::ops,
68    doc: "The version of the call operator that takes a mutable receiver.", FnMut }
69    reexport! { rust: core::ops,
70    doc: "The version of the call operator that takes a by-value receiver.", FnOnce }
71    reexport! { rust: core::ops,
72    doc: "Used for indexing operations (`container[index]`) in immutable contexts.", Index }
73    reexport! { rust: core::ops,
74    doc: "Used for indexing operations (`container[index]`) in mutable contexts.", IndexMut }
75    reexport! { rust: core::ops, doc: "The multiplication operator `*`.", Mul }
76    reexport! { rust: core::ops, doc: "The multiplication assignment operator `*=`.", MulAssign }
77    reexport! { rust: core::ops, doc: "The unary negation operator `-`.", Neg }
78    reexport! { rust: core::ops, doc: "The unary logical negation operator `!`.", Not }
79    reexport! { rust: core::ops, doc: "Implemented by Rust’s built-in range types", RangeBounds }
80    reexport! { rust: core::ops, doc: "The remainder operator `%`.", Rem }
81    reexport! { rust: core::ops, doc: "The remainder assignment operator `%=`.", RemAssign }
82    reexport! { rust: core::ops, doc: "The subtraction operator `-`.", Sub }
83    reexport! { rust: core::ops, doc: "The subtraction assignment operator `-=`.", SubAssign }
84}