Skip to content

Commit 30779de

Browse files
committed
Add panic default implementations
1 parent cab16d4 commit 30779de

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

libcc2rs/src/reinterpret.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,25 @@ pub trait ByteRepr: 'static {
88
where
99
Self: Sized,
1010
{
11-
std::mem::size_of::<Self>()
11+
panic!(
12+
"byte_size is not implemented for {}",
13+
std::any::type_name::<Self>()
14+
)
1215
}
1316
fn to_bytes(&self, _buf: &mut [u8]) {
14-
panic!("ByteRepr not supported for this type");
17+
panic!(
18+
"to_bytes is not implemented for {}",
19+
std::any::type_name::<Self>()
20+
)
1521
}
1622
fn from_bytes(_buf: &[u8]) -> Self
1723
where
1824
Self: Sized,
1925
{
20-
panic!("ByteRepr not supported for this type");
26+
panic!(
27+
"from_bytes is not implemented for {}",
28+
std::any::type_name::<Self>()
29+
)
2130
}
2231
}
2332

0 commit comments

Comments
 (0)