@@ -35,11 +35,10 @@ impl<T: TagTrait<Metadata = usize> + ?Sized> BoxedDst<T> {
3535 /// Create a boxed tag with the given content.
3636 ///
3737 /// # Parameters
38- /// - `typ` - The given [`TagTypeId`]
3938 /// - `content` - All payload bytes of the DST tag without the tag type or
4039 /// the size. The memory is only read and can be discarded
4140 /// afterwards.
42- pub ( crate ) fn new ( typ : impl Into < TagTypeId > , content : & [ u8 ] ) -> Self {
41+ pub ( crate ) fn new ( content : & [ u8 ] ) -> Self {
4342 // Currently, I do not find a nice way of making this dynamic so that
4443 // also miri is guaranteed to be happy. But it seems that 4 is fine
4544 // here. I do have control over allocation and deallocation.
@@ -63,7 +62,7 @@ impl<T: TagTrait<Metadata = usize> + ?Sized> BoxedDst<T> {
6362 unsafe {
6463 // write tag type
6564 let ptrx = ptr. cast :: < TagTypeId > ( ) ;
66- ptrx. write ( typ . into ( ) ) ;
65+ ptrx. write ( T :: ID . into ( ) ) ;
6766
6867 // write tag size
6968 let ptrx = ptrx. add ( 1 ) . cast :: < u32 > ( ) ;
@@ -139,11 +138,10 @@ mod tests {
139138
140139 #[ test]
141140 fn test_boxed_dst_tag ( ) {
142- let tag_type_id = 1337_u32 ;
143141 let content = "hallo" ;
144142
145- let tag = BoxedDst :: < CustomTag > :: new ( tag_type_id , content. as_bytes ( ) ) ;
146- assert_eq ! ( tag. typ, tag_type_id ) ;
143+ let tag = BoxedDst :: < CustomTag > :: new ( content. as_bytes ( ) ) ;
144+ assert_eq ! ( tag. typ, CustomTag :: ID ) ;
147145 assert_eq ! ( tag. size as usize , METADATA_SIZE + content. len( ) ) ;
148146 assert_eq ! ( tag. string( ) , Ok ( content) ) ;
149147 }
0 commit comments