@@ -15,13 +15,13 @@ use crate::{bincode_options, EntryIter, FileError, IterError};
1515///
1616/// The changesets are the results of altering a tracker implementation (`T`).
1717#[ derive( Debug ) ]
18- pub struct Store < ' a , C > {
19- magic : & ' a [ u8 ] ,
18+ pub struct Store < C > {
19+ magic_len : usize ,
2020 db_file : File ,
2121 marker : PhantomData < C > ,
2222}
2323
24- impl < ' a , C > PersistBackend < C > for Store < ' a , C >
24+ impl < C > PersistBackend < C > for Store < C >
2525where
2626 C : Append + serde:: Serialize + serde:: de:: DeserializeOwned ,
2727{
3838 }
3939}
4040
41- impl < ' a , C > Store < ' a , C >
41+ impl < C > Store < C >
4242where
4343 C : Append + serde:: Serialize + serde:: de:: DeserializeOwned ,
4444{
4848 /// the `Store` in the future with [`open`].
4949 ///
5050 /// [`open`]: Store::open
51- pub fn create_new < P > ( magic : & ' a [ u8 ] , file_path : P ) -> Result < Self , FileError >
51+ pub fn create_new < P > ( magic : & [ u8 ] , file_path : P ) -> Result < Self , FileError >
5252 where
5353 P : AsRef < Path > ,
5454 {
6767 . open ( file_path) ?;
6868 f. write_all ( magic) ?;
6969 Ok ( Self {
70- magic,
70+ magic_len : magic. len ( ) ,
7171 db_file : f,
7272 marker : Default :: default ( ) ,
7373 } )
8383 /// [`FileError::InvalidMagicBytes`] error variant will be returned.
8484 ///
8585 /// [`create_new`]: Store::create_new
86- pub fn open < P > ( magic : & ' a [ u8 ] , file_path : P ) -> Result < Self , FileError >
86+ pub fn open < P > ( magic : & [ u8 ] , file_path : P ) -> Result < Self , FileError >
8787 where
8888 P : AsRef < Path > ,
8989 {
9999 }
100100
101101 Ok ( Self {
102- magic,
102+ magic_len : magic. len ( ) ,
103103 db_file : f,
104104 marker : Default :: default ( ) ,
105105 } )
@@ -111,7 +111,7 @@ where
111111 ///
112112 /// [`open`]: Store::open
113113 /// [`create_new`]: Store::create_new
114- pub fn open_or_create_new < P > ( magic : & ' a [ u8 ] , file_path : P ) -> Result < Self , FileError >
114+ pub fn open_or_create_new < P > ( magic : & [ u8 ] , file_path : P ) -> Result < Self , FileError >
115115 where
116116 P : AsRef < Path > ,
117117 {
@@ -132,7 +132,7 @@ where
132132 /// always iterate over all entries until `None` is returned if you want your next write to go
133133 /// at the end; otherwise, you will write over existing entries.
134134 pub fn iter_changesets ( & mut self ) -> EntryIter < C > {
135- EntryIter :: new ( self . magic . len ( ) as u64 , & mut self . db_file )
135+ EntryIter :: new ( self . magic_len as u64 , & mut self . db_file )
136136 }
137137
138138 /// Loads all the changesets that have been stored as one giant changeset.
0 commit comments