| 1 | /// A set of text effects |
| 2 | /// |
| 3 | /// # Examples |
| 4 | /// |
| 5 | /// ```rust |
| 6 | /// let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; |
| 7 | /// ``` |
| 8 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)] |
| 9 | pub struct Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(u16); |
| 10 | |
| 11 | impl Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects# { |
| 12 | /// No [`Effects`] applied |
| 13 | const PLAINrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]PLAIN.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(0); |
| 14 | |
| 15 | #[allow(missing_docs)] |
| 16 | pub const BOLDrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]BOLD.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().0); |
| 17 | #[allow(missing_docs)] |
| 18 | pub const DIMMEDrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]DIMMED.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().1); |
| 19 | /// Not widely supported. Sometimes treated as inverse or blink |
| 20 | pub const ITALICrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]ITALIC.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().2); |
| 21 | /// Style extensions exist for Kitty, VTE, mintty and iTerm2. |
| 22 | pub const UNDERLINErust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]UNDERLINE.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().3); |
| 23 | #[allow(missing_docs)] |
| 24 | pub const DOUBLE_UNDERLINErust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]DOUBLE_UNDERLINE.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().4); |
| 25 | #[allow(missing_docs)] |
| 26 | pub const CURLY_UNDERLINErust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]CURLY_UNDERLINE.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().5); |
| 27 | #[allow(missing_docs)] |
| 28 | pub const DOTTED_UNDERLINErust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]DOTTED_UNDERLINE.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().6); |
| 29 | #[allow(missing_docs)] |
| 30 | pub const DASHED_UNDERLINErust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]DASHED_UNDERLINE.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().7); |
| 31 | #[allow(missing_docs)] |
| 32 | pub const BLINKrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]BLINK.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().8); |
| 33 | /// Swap foreground and background colors; inconsistent emulation |
| 34 | pub const INVERTrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]INVERT.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().9); |
| 35 | #[allow(missing_docs)] |
| 36 | pub const HIDDENrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]HIDDEN.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().10); |
| 37 | /// Characters legible but marked as if for deletion. Not supported in Terminal.app |
| 38 | pub const STRIKETHROUGHrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]STRIKETHROUGH.: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<i32>`]shl().11); |
| 39 | |
| 40 | /// No effects enabled |
| 41 | /// |
| 42 | /// # Examples |
| 43 | /// |
| 44 | /// ```rust |
| 45 | /// let effects = anstyle::Effects::new(); |
| 46 | /// ``` |
| 47 | #[inline] |
| 48 | pub const fn newrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]new().() -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] { |
| 49 | Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]::PLAINrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]PLAIN. |
| 50 | } |
| 51 | |
| 52 | /// Check if no effects are enabled |
| 53 | /// |
| 54 | /// # Examples |
| 55 | /// |
| 56 | /// ```rust |
| 57 | /// let effects = anstyle::Effects::new(); |
| 58 | /// assert!(effects.is_plain()); |
| 59 | /// |
| 60 | /// let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; |
| 61 | /// assert!(!effects.is_plain()); |
| 62 | /// ``` |
| 63 | #[inline] |
| 64 | pub const fn is_plainrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]is_plain().(self) -> bool { |
| 65 | self.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]::PLAINrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]PLAIN..0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0. |
| 66 | } |
| 67 | |
| 68 | /// Returns `true` if all of the effects in `other` are contained within `self`. |
| 69 | /// |
| 70 | /// # Examples |
| 71 | /// |
| 72 | /// ```rust |
| 73 | /// let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; |
| 74 | /// assert!(effects.contains(anstyle::Effects::BOLD)); |
| 75 | /// |
| 76 | /// let effects = anstyle::Effects::new(); |
| 77 | /// assert!(!effects.contains(anstyle::Effects::BOLD)); |
| 78 | /// ``` |
| 79 | #[inline(always)] |
| 80 | pub const fn containsrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]contains().(self, other: Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#) -> bool { |
| 81 | (other.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAnd<Self>`]bitand().self.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().other.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0. |
| 82 | } |
| 83 | |
| 84 | /// Inserts the specified effects in-place. |
| 85 | /// |
| 86 | /// # Examples |
| 87 | /// |
| 88 | /// ```rust |
| 89 | /// let effects = anstyle::Effects::new().insert(anstyle::Effects::new()); |
| 90 | /// assert!(effects.is_plain()); |
| 91 | /// |
| 92 | /// let effects = anstyle::Effects::new().insert(anstyle::Effects::BOLD); |
| 93 | /// assert!(effects.contains(anstyle::Effects::BOLD)); |
| 94 | /// ``` |
| 95 | #[inline(always)] |
| 96 | #[must_use] |
| 97 | pub const fn insertrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]insert().(mut self, other: Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#) -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] { |
| 98 | self.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().other.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0.; |
| 99 | self |
| 100 | } |
| 101 | |
| 102 | /// Removes the specified effects in-place. |
| 103 | /// |
| 104 | /// # Examples |
| 105 | /// |
| 106 | /// ```rust |
| 107 | /// let effects = (anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE).remove(anstyle::Effects::BOLD); |
| 108 | /// assert!(!effects.contains(anstyle::Effects::BOLD)); |
| 109 | /// assert!(effects.contains(anstyle::Effects::UNDERLINE)); |
| 110 | /// ``` |
| 111 | #[inline(always)] |
| 112 | #[must_use] |
| 113 | pub const fn removerust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]remove().(mut self, other: Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#) -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] { |
| 114 | self.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAndAssign<Self>`]bitand_assign().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][Not]not().other.0rust-analyzer cargo anstyle 1.0.14 effect/Effects#0.; |
| 115 | self |
| 116 | } |
| 117 | |
| 118 | /// Reset all effects in-place |
| 119 | /// ```rust |
| 120 | /// let effects = (anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE).clear(); |
| 121 | /// assert!(!effects.contains(anstyle::Effects::BOLD)); |
| 122 | /// assert!(!effects.contains(anstyle::Effects::UNDERLINE)); |
| 123 | /// ``` |
| 124 | #[inline(always)] |
| 125 | #[must_use] |
| 126 | pub const fn clearrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]clear().(self) -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] { |
| 127 | Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]::newrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]new().() |
| 128 | } |
| 129 | |
| 130 | /// Enable or disable the specified effects depending on the passed value. |
| 131 | /// |
| 132 | /// # Examples |
| 133 | /// |
| 134 | /// ```rust |
| 135 | /// let effects = anstyle::Effects::new().set(anstyle::Effects::BOLD, true); |
| 136 | /// assert!(effects.contains(anstyle::Effects::BOLD)); |
| 137 | /// ``` |
| 138 | #[inline] |
| 139 | #[must_use] |
| 140 | pub const fn setrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]set().(self, other: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects], enable: bool) -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects] { |
| 141 | if enable { |
| 142 | self.insertrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]insert().(other) |
| 143 | } else { |
| 144 | self.removerust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]remove().(other) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /// Iterate over enabled effects |
| 149 | #[inline(always)] |
| 150 | pub fn iterrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]iter().(self) -> EffectIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIter# { |
| 151 | EffectIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIter# { |
| 152 | indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#index.: 0, |
| 153 | effectsrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#effects.: self, |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /// Iterate over enabled effect indices |
| 158 | #[inline(always)] |
| 159 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) fn index_iterrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]index_iter().(self) -> EffectIndexIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter# { |
| 160 | EffectIndexIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter# { |
| 161 | indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#index.: 0, |
| 162 | effectsrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#effects.: self, |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | /// Render the ANSI code |
| 167 | #[inline] |
| 168 | pub fn renderrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]render().(self) -> impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# { |
| 169 | EffectsDisplayrust-analyzer cargo anstyle 1.0.14 effect/EffectsDisplay#(self) |
| 170 | } |
| 171 | |
| 172 | #[inline] |
| 173 | #[cfg(feature = "std")] |
| 174 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) fn write_torust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]write_to().(self, write: &mut dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 175 | for index in self.index_iterrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]index_iter().() { |
| 176 | write.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write_all().(METADATArust-analyzer cargo anstyle 1.0.14 effect/METADATA.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape..as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 177 | } |
| 178 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /// # Examples |
| 183 | /// |
| 184 | /// ```rust |
| 185 | /// let effects = anstyle::Effects::new(); |
| 186 | /// assert_eq!(format!("{:?}", effects), "Effects()"); |
| 187 | /// |
| 188 | /// let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; |
| 189 | /// assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)"); |
| 190 | /// ``` |
| 191 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects# { |
| 192 | fn fmtrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][Debug]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 193 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Effects(")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 194 | for (i, index) in self.index_iterrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]index_iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 195 | if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 196 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, " | ")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 197 | } |
| 198 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", METADATArust-analyzer cargo anstyle 1.0.14 effect/METADATA.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 199 | } |
| 200 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ")")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 201 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | /// # Examples |
| 206 | /// |
| 207 | /// ```rust |
| 208 | /// let effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; |
| 209 | /// assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)"); |
| 210 | /// ``` |
| 211 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr# for Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects# { |
| 212 | type Outputrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOr<Self>`]Output# = Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOr<Self>`]; |
| 213 | |
| 214 | #[inline(always)] |
| 215 | fn bitorrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOr<Self>`]bitor().(self, rhs: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOr<Self>`]) -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOr<Self>`] { |
| 216 | self.insertrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]insert().(rhs) |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /// # Examples |
| 221 | /// |
| 222 | /// ```rust |
| 223 | /// let mut effects = anstyle::Effects::BOLD; |
| 224 | /// effects |= anstyle::Effects::UNDERLINE; |
| 225 | /// assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)"); |
| 226 | /// ``` |
| 227 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::BitOrAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOrAssign# for Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects# { |
| 228 | #[inline] |
| 229 | fn bitor_assignrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOrAssign<Self>`]bitor_assign().(&mut self, other: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`BitOrAssign<Self>`]) { |
| 230 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = self.insertrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]insert().(other); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | /// # Examples |
| 235 | /// |
| 236 | /// ```rust |
| 237 | /// let effects = (anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE) - anstyle::Effects::BOLD; |
| 238 | /// assert_eq!(format!("{:?}", effects), "Effects(UNDERLINE)"); |
| 239 | /// ``` |
| 240 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub# for Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects# { |
| 241 | type Outputrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`Sub<Self>`]Output# = Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`Sub<Self>`]; |
| 242 | |
| 243 | #[inline] |
| 244 | fn subrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`Sub<Self>`]sub().(self, other: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`Sub<Self>`]) -> Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`Sub<Self>`] { |
| 245 | self.removerust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]remove().(other) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | /// # Examples |
| 250 | /// |
| 251 | /// ```rust |
| 252 | /// let mut effects = anstyle::Effects::BOLD | anstyle::Effects::UNDERLINE; |
| 253 | /// effects -= anstyle::Effects::BOLD; |
| 254 | /// assert_eq!(format!("{:?}", effects), "Effects(UNDERLINE)"); |
| 255 | /// ``` |
| 256 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::SubAssignrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/SubAssign# for Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects# { |
| 257 | #[inline] |
| 258 | fn sub_assignrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`SubAssign<Self>`]sub_assign().(&mut self, other: Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects][`SubAssign<Self>`]) { |
| 259 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = self.removerust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]remove().(other); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) struct Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 264 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: &'static str, |
| 265 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: &'static str, |
| 266 | } |
| 267 | |
| 268 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) const METADATArust-analyzer cargo anstyle 1.0.14 effect/METADATA.: [Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata#; 12] = [ |
| 269 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 270 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "BOLD", |
| 271 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("1"), |
| 272 | }, |
| 273 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 274 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "DIMMED", |
| 275 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("2"), |
| 276 | }, |
| 277 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 278 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "ITALIC", |
| 279 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("3"), |
| 280 | }, |
| 281 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 282 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "UNDERLINE", |
| 283 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("4"), |
| 284 | }, |
| 285 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 286 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "DOUBLE_UNDERLINE", |
| 287 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("21"), |
| 288 | }, |
| 289 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 290 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "CURLY_UNDERLINE", |
| 291 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("4:3"), |
| 292 | }, |
| 293 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 294 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "DOTTED_UNDERLINE", |
| 295 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("4:4"), |
| 296 | }, |
| 297 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 298 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "DASHED_UNDERLINE", |
| 299 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("4:5"), |
| 300 | }, |
| 301 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 302 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "BLINK", |
| 303 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("5"), |
| 304 | }, |
| 305 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 306 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "INVERT", |
| 307 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("7"), |
| 308 | }, |
| 309 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 310 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "HIDDEN", |
| 311 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("8"), |
| 312 | }, |
| 313 | Metadatarust-analyzer cargo anstyle 1.0.14 effect/Metadata# { |
| 314 | namerust-analyzer cargo anstyle 1.0.14 effect/Metadata#name.: "STRIKETHROUGH", |
| 315 | escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.: escaperust-analyzer cargo anstyle 1.0.14 macros/escape!!("9"), |
| 316 | }, |
| 317 | ]; |
| 318 | |
| 319 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 320 | struct EffectsDisplayrust-analyzer cargo anstyle 1.0.14 effect/EffectsDisplay#(Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#); |
| 321 | |
| 322 | impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for EffectsDisplayrust-analyzer cargo anstyle 1.0.14 effect/EffectsDisplay# { |
| 323 | #[inline] |
| 324 | fn fmtrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectsDisplay][Display]fmt().(&self, f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 325 | for index in self.0rust-analyzer cargo anstyle 1.0.14 effect/EffectsDisplay#0..index_iterrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]index_iter().() { |
| 326 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(METADATArust-analyzer cargo anstyle 1.0.14 effect/METADATA.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..escaperust-analyzer cargo anstyle 1.0.14 effect/Metadata#escape.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 327 | } |
| 328 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | /// Enumerate each enabled value in [`Effects`] |
| 333 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 334 | pub struct EffectIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIter# { |
| 335 | indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#index.: usize, |
| 336 | effectsrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#effects.: Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#, |
| 337 | } |
| 338 | |
| 339 | impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for EffectIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIter# { |
| 340 | type Itemrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectIter][Iterator]Item# = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#; |
| 341 | |
| 342 | fn nextrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectIter][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectIter][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 343 | while self.indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().METADATArust-analyzer cargo anstyle 1.0.14 effect/METADATA..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 344 | let index = self.indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#index.; |
| 345 | self.indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 346 | |
| 347 | let effect = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<usize>`]shl().index); |
| 348 | if self.effectsrust-analyzer cargo anstyle 1.0.14 effect/EffectIter#effects..containsrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]contains().(effect) { |
| 349 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(effect); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 358 | pub(craterust-analyzer cargo anstyle 1.0.14 crate/) struct EffectIndexIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter# { |
| 359 | indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#index.: usize, |
| 360 | effectsrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#effects.: Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#, |
| 361 | } |
| 362 | |
| 363 | impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for EffectIndexIterrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter# { |
| 364 | type Itemrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectIndexIter][Iterator]Item# = usize; |
| 365 | |
| 366 | fn nextrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectIndexIter][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo anstyle 1.0.14 effect/impl#[EffectIndexIter][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 367 | while self.indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().METADATArust-analyzer cargo anstyle 1.0.14 effect/METADATA..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 368 | let index = self.indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#index.; |
| 369 | self.indexrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 370 | |
| 371 | let effect = Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#(1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<usize>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<usize>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<usize>`]shl().index); |
| 372 | if self.effectsrust-analyzer cargo anstyle 1.0.14 effect/EffectIndexIter#effects..containsrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]contains().(effect) { |
| 373 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index); |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | #[cfg(test)] |
| 382 | #[cfg(feature = "std")] |
| 383 | mod testrust-analyzer cargo anstyle 1.0.14 effect/test/ { |
| 384 | use superrust-analyzer cargo anstyle 1.0.14 effect/::*; |
| 385 | |
| 386 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 387 | fn print_size_ofrust-analyzer cargo anstyle 1.0.14 effect/test/print_size_of().() { |
| 388 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().; |
| 389 | dbgrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/dbg!!(size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#>()); |
| 390 | dbgrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/dbg!!(size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<EffectsDisplayrust-analyzer cargo anstyle 1.0.14 effect/EffectsDisplay#>()); |
| 391 | } |
| 392 | |
| 393 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 394 | fn no_alignrust-analyzer cargo anstyle 1.0.14 effect/test/no_align().() { |
| 395 | #[track_caller] |
| 396 | fn assert_no_alignrust-analyzer cargo anstyle 1.0.14 effect/test/assert_no_align().(d: impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) { |
| 397 | let expected = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{d}"); |
| 398 | let actual = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{d:<10}"); |
| 399 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 400 | } |
| 401 | |
| 402 | assert_no_alignrust-analyzer cargo anstyle 1.0.14 effect/test/assert_no_align().(Effectsrust-analyzer cargo anstyle 1.0.14 effect/Effects#::BOLDrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]BOLD..renderrust-analyzer cargo anstyle 1.0.14 effect/impl#[Effects]render().()); |
| 403 | } |
| 404 | } |