File tree Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Expand file tree Collapse file tree 4 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,13 @@ pub enum TruncSide {
97
97
Right ,
98
98
}
99
99
100
- /// A proxy trait to a core type.
100
+ /// A proxy trait to the core block-level type.
101
101
pub trait CoreProxy {
102
- /// Wrapped block-level type.
103
- type Core ;
102
+ /// Core block-level type.
103
+ type Core : BufferKindUser ;
104
+
105
+ /// Create `Self` from core and buffer.
106
+ fn compose ( core : Self :: Core , buffer : Buffer < Self :: Core > ) -> Self ;
107
+ /// Decompose `self` into core and buffer.
108
+ fn decompose ( self ) -> ( Self :: Core , Buffer < Self :: Core > ) ;
104
109
}
Original file line number Diff line number Diff line change @@ -179,6 +179,13 @@ macro_rules! buffer_fixed {
179
179
) => {
180
180
impl $( < $( $lt $( : $clt $( + $dlt ) * ) ? ) ,+ >) ? $crate:: block_api:: CoreProxy for $name$( < $( $lt ) ,+ >) ? {
181
181
type Core = $core_ty;
182
+ fn compose( core: Self :: Core , buffer: $crate:: block_api:: Buffer <Self :: Core >) -> Self {
183
+ Self { core, buffer }
184
+ }
185
+ fn decompose( self ) -> ( Self :: Core , $crate:: block_api:: Buffer <Self :: Core >) {
186
+ let Self { core, buffer } = self ;
187
+ ( core, buffer)
188
+ }
182
189
}
183
190
184
191
$crate:: buffer_fixed!( impl_inner: $name$( < $( $lt $( : $clt $( + $dlt ) * ) ? ) ,+ >) ?( $core_ty) ; $( $trait_name) * ; ) ;
Original file line number Diff line number Diff line change @@ -112,6 +112,13 @@ macro_rules! buffer_ct_variable {
112
112
$out_size: $crate:: array:: ArraySize + $crate:: typenum:: IsLessOrEqual <$max_size, Output = $crate:: typenum:: True >,
113
113
{
114
114
type Core = $crate:: block_api:: CtOutWrapper <$core_ty, $out_size>;
115
+ fn compose( core: Self :: Core , buffer: $crate:: block_api:: Buffer <Self :: Core >) -> Self {
116
+ Self { core, buffer }
117
+ }
118
+ fn decompose( self ) -> ( Self :: Core , $crate:: block_api:: Buffer <Self :: Core >) {
119
+ let Self { core, buffer } = self ;
120
+ ( core, buffer)
121
+ }
115
122
}
116
123
117
124
impl <$out_size> $crate:: Update for $name<$out_size>
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ macro_rules! buffer_xof {
87
87
) => {
88
88
$crate:: buffer_xof!(
89
89
impl_inner: $name( $core_ty) ;
90
- Debug Clone BlockSizeUser CoreProxy
90
+ Debug Clone BlockSizeUser
91
91
$( $trait_name) * ; ) ;
92
92
} ;
93
93
@@ -194,6 +194,13 @@ macro_rules! buffer_xof {
194
194
) => {
195
195
impl $crate:: block_api:: CoreProxy for $name {
196
196
type Core = $core_ty;
197
+ fn compose( core: Self :: Core , buffer: $crate:: block_api:: Buffer <Self :: Core >) -> Self {
198
+ Self { core, buffer }
199
+ }
200
+ fn decompose( self ) -> ( Self :: Core , $crate:: block_api:: Buffer <Self :: Core >) {
201
+ let Self { core, buffer } = self ;
202
+ ( core, buffer)
203
+ }
197
204
}
198
205
199
206
$crate:: buffer_xof!( impl_inner: $name( $core_ty) ; $( $trait_name) * ; ) ;
You can’t perform that action at this time.
0 commit comments