We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0a8eb4 commit f94e645Copy full SHA for f94e645
src/lib.rs
@@ -174,3 +174,21 @@ pub enum TryReserveError {
174
layout: stdalloc::alloc::Layout,
175
},
176
}
177
+
178
+// matches stdalloc::collections::TryReserveError
179
+impl core::fmt::Display for TryReserveError {
180
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
181
+ f.write_str("memory allocation failed")?;
182
+ let reason = match self {
183
+ TryReserveError::CapacityOverflow => {
184
+ " because the computed capacity exceeded the collection's maximum"
185
+ }
186
+ TryReserveError::AllocError { .. } => {
187
+ " because the memory allocator returned an error"
188
189
+ };
190
+ f.write_str(reason)
191
192
+}
193
194
+impl core::error::Error for TryReserveError {}
0 commit comments