@@ -16,16 +16,16 @@ use crate::{
1616/// An arithmetic decoder converts a stream of symbols into a stream of bits,
1717/// using a predictive [`Model`].
1818#[ derive( Debug ) ]
19- pub struct Encoder < ' a , M , W >
19+ pub struct Encoder < M , W >
2020where
2121 M : Model ,
2222 W : BitWrite ,
2323{
2424 model : M ,
25- state : State < ' a , M :: B , W > ,
25+ state : State < M :: B , W > ,
2626}
2727
28- impl < ' a , M , W > Encoder < ' a , M , W >
28+ impl < M , W > Encoder < M , W >
2929where
3030 M : Model ,
3131 W : BitWrite ,
4848 ///
4949 /// If these constraints cannot be satisfied this method will panic in debug
5050 /// builds
51- pub fn new ( model : M , bitwriter : & ' a mut W ) -> Self {
51+ pub fn new ( model : M , bitwriter : W ) -> Self {
5252 let frequency_bits = model. max_denominator ( ) . log2 ( ) + 1 ;
5353 let precision = M :: B :: BITS - frequency_bits;
5454 Self :: with_precision ( model, bitwriter, precision)
6767 ///
6868 /// If these constraints cannot be satisfied this method will panic in debug
6969 /// builds
70- pub fn with_precision ( model : M , bitwriter : & ' a mut W , precision : u32 ) -> Self {
70+ pub fn with_precision ( model : M , bitwriter : W , precision : u32 ) -> Self {
7171 let state = State :: new ( precision, bitwriter) ;
7272 Self :: with_state ( state, model)
7373 }
7676 ///
7777 /// This is useful for manually chaining a shared buffer through multiple
7878 /// encoders.
79- pub fn with_state ( state : State < ' a , M :: B , W > , model : M ) -> Self {
79+ pub fn with_state ( state : State < M :: B , W > , model : M ) -> Self {
8080 #[ cfg( debug_assertions) ]
8181 assert_precision_sufficient :: < M > ( model. max_denominator ( ) , state. state . precision ) ;
8282 Self { model, state }
@@ -143,15 +143,15 @@ where
143143 }
144144
145145 /// Return the internal model and state of the encoder.
146- pub fn into_inner ( self ) -> ( M , State < ' a , M :: B , W > ) {
146+ pub fn into_inner ( self ) -> ( M , State < M :: B , W > ) {
147147 ( self . model , self . state )
148148 }
149149
150150 /// Reuse the internal state of the Encoder with a new model.
151151 ///
152152 /// Allows for chaining multiple sequences of symbols into a single stream
153153 /// of bits
154- pub fn chain < X > ( self , model : X ) -> Encoder < ' a , X , W >
154+ pub fn chain < X > ( self , model : X ) -> Encoder < X , W >
155155 where
156156 X : Model < B = M :: B > ,
157157 {
@@ -161,18 +161,18 @@ where
161161
162162/// A convenience struct which stores the internal state of an [`Encoder`].
163163#[ derive( Debug ) ]
164- pub struct State < ' a , B , W >
164+ pub struct State < B , W >
165165where
166166 B : BitStore ,
167167 W : BitWrite ,
168168{
169169 #[ allow( clippy:: struct_field_names) ]
170170 state : common:: State < B > ,
171171 pending : u32 ,
172- output : & ' a mut W ,
172+ output : W ,
173173}
174174
175- impl < ' a , B , W > State < ' a , B , W >
175+ impl < B , W > State < B , W >
176176where
177177 B : BitStore ,
178178 W : BitWrite ,
@@ -181,7 +181,7 @@ where
181181 ///
182182 /// Normally this would be done automatically using the [`Encoder::new`]
183183 /// method.
184- pub fn new ( precision : u32 , output : & ' a mut W ) -> Self {
184+ pub fn new ( precision : u32 , output : W ) -> Self {
185185 let state = common:: State :: new ( precision) ;
186186 let pending = 0 ;
187187
0 commit comments