(&mut self, message: &str)
| 134 | /// This will do nothing when compiled without debug assertions. |
| 135 | #[allow(unused)] |
| 136 | pub fn try_debug(&mut self, message: &str) -> Result<(), RealtimeLogError> { |
| 137 | #[cfg(debug_assertions)] |
| 138 | { |
| 139 | if message.len() > self.max_msg_length { |
| 140 | self.shared_state |
| 141 | .message_too_long_occurred |
| 142 | .store(true, Ordering::Relaxed); |
| 143 | return Err(RealtimeLogError::MessageTooLong); |
| 144 | } |
| 145 | |
| 146 | let Some(mut slot) = self.debug_cons.try_pop() else { |
| 147 | self.shared_state |
| 148 | .not_enough_slots_occurred |
| 149 | .store(true, Ordering::Relaxed); |
| 150 | return Err(RealtimeLogError::OutOfSlots); |
| 151 | }; |
| 152 | |
| 153 | slot.clear(); |
| 154 | slot.push_str(message); |
| 155 | |
| 156 | let _ = self.debug_prod.try_push(slot); |
| 157 | } |
| 158 | |
| 159 | Ok(()) |
| 160 | } |
| 161 | |
| 162 | /// Log a debug message into the given string. |
| 163 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected