functions in structs, in general

This commit is contained in:
Folkert 2023-04-04 11:47:37 +02:00
parent b7119e9b3a
commit 9a6f9ad26e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
7 changed files with 42 additions and 13 deletions

View file

@ -387,7 +387,28 @@ impl<'a> Copy for InLayout<'a> {}
impl std::fmt::Debug for InLayout<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("InLayout").field(&self.0).finish()
match *self {
Layout::VOID => f.write_str("InLayout(VOID)"),
Layout::UNIT => f.write_str("InLayout(UNIT)"),
Layout::BOOL => f.write_str("InLayout(BOOL)"),
Layout::U8 => f.write_str("InLayout(U8)"),
Layout::U16 => f.write_str("InLayout(U16)"),
Layout::U32 => f.write_str("InLayout(U32)"),
Layout::U64 => f.write_str("InLayout(U64)"),
Layout::U128 => f.write_str("InLayout(U128)"),
Layout::I8 => f.write_str("InLayout(I8)"),
Layout::I16 => f.write_str("InLayout(I16)"),
Layout::I32 => f.write_str("InLayout(I32)"),
Layout::I64 => f.write_str("InLayout(I64)"),
Layout::I128 => f.write_str("InLayout(I128)"),
Layout::F32 => f.write_str("InLayout(F32)"),
Layout::F64 => f.write_str("InLayout(F64)"),
Layout::DEC => f.write_str("InLayout(DEC)"),
Layout::STR => f.write_str("InLayout(STR)"),
Layout::OPAQUE_PTR => f.write_str("InLayout(OPAQUE_PTR)"),
Layout::NAKED_RECURSIVE_PTR => f.write_str("InLayout(NAKED_RECURSIVE_PTR)"),
_ => f.debug_tuple("InLayout").field(&self.0).finish(),
}
}
}