@@ -35,11 +35,10 @@ impl<T: TagTrait<Metadata = usize> + ?Sized> BoxedDst<T> {
35
35
/// Create a boxed tag with the given content.
36
36
///
37
37
/// # Parameters
38
- /// - `typ` - The given [`TagTypeId`]
39
38
/// - `content` - All payload bytes of the DST tag without the tag type or
40
39
/// the size. The memory is only read and can be discarded
41
40
/// afterwards.
42
- pub ( crate ) fn new ( typ : impl Into < TagTypeId > , content : & [ u8 ] ) -> Self {
41
+ pub ( crate ) fn new ( content : & [ u8 ] ) -> Self {
43
42
// Currently, I do not find a nice way of making this dynamic so that
44
43
// also miri is guaranteed to be happy. But it seems that 4 is fine
45
44
// here. I do have control over allocation and deallocation.
@@ -63,7 +62,7 @@ impl<T: TagTrait<Metadata = usize> + ?Sized> BoxedDst<T> {
63
62
unsafe {
64
63
// write tag type
65
64
let ptrx = ptr. cast :: < TagTypeId > ( ) ;
66
- ptrx. write ( typ . into ( ) ) ;
65
+ ptrx. write ( T :: ID . into ( ) ) ;
67
66
68
67
// write tag size
69
68
let ptrx = ptrx. add ( 1 ) . cast :: < u32 > ( ) ;
@@ -139,11 +138,10 @@ mod tests {
139
138
140
139
#[ test]
141
140
fn test_boxed_dst_tag ( ) {
142
- let tag_type_id = 1337_u32 ;
143
141
let content = "hallo" ;
144
142
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 ) ;
147
145
assert_eq ! ( tag. size as usize , METADATA_SIZE + content. len( ) ) ;
148
146
assert_eq ! ( tag. string( ) , Ok ( content) ) ;
149
147
}
0 commit comments