mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Remove unused lifetime parameters
This commit is contained in:
@@ -30,7 +30,7 @@ impl DemoVal {
|
||||
.transaction(Rc::downgrade(&storage.sb), |sb| self.numbers_impl(sb))
|
||||
}
|
||||
|
||||
fn write_to_entry<'a, SB: StorageBackend, Tx: StorageTxMut<'a, SB>>(
|
||||
fn write_to_entry<SB: StorageBackend, Tx: StorageTxMut<SB>>(
|
||||
&self,
|
||||
tx: &mut Tx,
|
||||
entry: &mut StorageEntry,
|
||||
@@ -62,7 +62,7 @@ impl DemoVal {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_from_entry<'a, SB: StorageBackend, Tx: StorageReader<'a, SB>>(
|
||||
fn read_from_entry<SB: StorageBackend, Tx: StorageReader<SB>>(
|
||||
_tx: &mut Tx,
|
||||
reader: &mut StorageEntryReader,
|
||||
) -> Result<DemoVal, GenericError> {
|
||||
@@ -91,7 +91,7 @@ impl DemoVal {
|
||||
})
|
||||
}
|
||||
|
||||
fn numbers_impl<'a, SB: StorageBackend, Tx: StorageReader<'a, SB>>(
|
||||
fn numbers_impl<SB: StorageBackend, Tx: StorageReader<SB>>(
|
||||
&self,
|
||||
tx: &mut Tx,
|
||||
) -> Result<Vec<u64>, GenericError> {
|
||||
@@ -115,7 +115,7 @@ impl DemoVal {
|
||||
}
|
||||
|
||||
impl<SB: StorageBackend> StorageEntity<SB> for DemoVal {
|
||||
fn to_storage_entry<'a, Tx: StorageTxMut<'a, SB>>(
|
||||
fn to_storage_entry<'a, Tx: StorageTxMut<SB>>(
|
||||
&self,
|
||||
tx: &mut Tx,
|
||||
) -> Result<StorageEntry, GenericError> {
|
||||
@@ -145,7 +145,7 @@ impl<SB: StorageBackend> StorageEntity<SB> for DemoVal {
|
||||
Ok(entry)
|
||||
}
|
||||
|
||||
fn from_storage_entry<'a, Tx: StorageReader<'a, SB>>(
|
||||
fn from_storage_entry<'a, Tx: StorageReader<SB>>(
|
||||
tx: &mut Tx,
|
||||
entry: StorageEntry,
|
||||
) -> Result<Self, GenericError> {
|
||||
|
||||
@@ -74,7 +74,7 @@ pub struct MemoryTx<'a> {
|
||||
storage: &'a MemoryBackend,
|
||||
}
|
||||
|
||||
impl StorageReader<'_, MemoryBackend> for MemoryTx<'_> {
|
||||
impl<'a> StorageReader<MemoryBackend> for MemoryTx<'a> {
|
||||
fn read_bytes<T>(&self, ptr: StoragePtr<T>) -> Result<Option<Vec<u8>>, GenericError> {
|
||||
Ok(self.storage.data.get(&ptr.data).cloned())
|
||||
}
|
||||
@@ -91,7 +91,7 @@ pub struct MemoryTxMut<'a> {
|
||||
storage: &'a mut MemoryBackend,
|
||||
}
|
||||
|
||||
impl<'a> StorageReader<'a, MemoryBackend> for MemoryTxMut<'a> {
|
||||
impl<'a> StorageReader<MemoryBackend> for MemoryTxMut<'a> {
|
||||
fn read_bytes<T>(&self, ptr: StoragePtr<T>) -> Result<Option<Vec<u8>>, GenericError> {
|
||||
Ok(self.storage.data.get(&ptr.data).cloned())
|
||||
}
|
||||
@@ -101,7 +101,7 @@ impl<'a> StorageReader<'a, MemoryBackend> for MemoryTxMut<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StorageTxMut<'a, MemoryBackend> for MemoryTxMut<'a> {
|
||||
impl<'a> StorageTxMut<MemoryBackend> for MemoryTxMut<'a> {
|
||||
fn ref_deltas(&mut self) -> &mut HashMap<(u64, u64, u64), i64> {
|
||||
&mut self.ref_deltas
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ pub struct SledTx<'a> {
|
||||
tx: &'a sled::transaction::TransactionalTree,
|
||||
}
|
||||
|
||||
impl<'a> StorageReader<'a, SledBackend> for SledTx<'a> {
|
||||
impl<'a> StorageReader<SledBackend> for SledTx<'a> {
|
||||
fn read_bytes<T>(&self, ptr: StoragePtr<T>) -> Result<Option<Vec<u8>>, GenericError> {
|
||||
let value = self
|
||||
.tx
|
||||
@@ -121,7 +121,7 @@ pub struct SledTxMut<'a> {
|
||||
tx: &'a sled::transaction::TransactionalTree,
|
||||
}
|
||||
|
||||
impl<'a> StorageReader<'a, SledBackend> for SledTxMut<'a> {
|
||||
impl<'a> StorageReader<SledBackend> for SledTxMut<'a> {
|
||||
fn read_bytes<T>(&self, ptr: StoragePtr<T>) -> Result<Option<Vec<u8>>, GenericError> {
|
||||
let value = self
|
||||
.tx
|
||||
@@ -137,7 +137,7 @@ impl<'a> StorageReader<'a, SledBackend> for SledTxMut<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StorageTxMut<'a, SledBackend> for SledTxMut<'a> {
|
||||
impl<'a> StorageTxMut<SledBackend> for SledTxMut<'a> {
|
||||
fn ref_deltas(&mut self) -> &mut HashMap<(u64, u64, u64), i64> {
|
||||
&mut self.ref_deltas
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ use crate::{
|
||||
|
||||
pub trait StorageBackend: Sized {
|
||||
type CustomError;
|
||||
type Tx<'a>: StorageReader<'a, Self>;
|
||||
type TxMut<'a>: StorageTxMut<'a, Self>;
|
||||
type Tx<'a>: StorageReader<Self>;
|
||||
type TxMut<'a>: StorageTxMut<Self>;
|
||||
|
||||
fn transaction<F, T>(&self, self_weak: Weak<RefCell<Self>>, f: F) -> Result<T, Box<dyn Error>>
|
||||
where
|
||||
|
||||
@@ -5,12 +5,12 @@ use crate::{
|
||||
};
|
||||
|
||||
pub trait StorageEntity<SB: StorageBackend>: Sized {
|
||||
fn to_storage_entry<'a, Tx: StorageTxMut<'a, SB>>(
|
||||
fn to_storage_entry<Tx: StorageTxMut<SB>>(
|
||||
&self,
|
||||
tx: &mut Tx,
|
||||
) -> Result<StorageEntry, GenericError>;
|
||||
|
||||
fn from_storage_entry<'a, Tx: StorageReader<'a, SB>>(
|
||||
fn from_storage_entry<Tx: StorageReader<SB>>(
|
||||
tx: &mut Tx,
|
||||
entry: StorageEntry,
|
||||
) -> Result<Self, GenericError>;
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
StorageHeadPtr, StoragePtr,
|
||||
};
|
||||
|
||||
pub trait StorageReader<'a, SB: StorageBackend>: Sized {
|
||||
pub trait StorageReader<SB: StorageBackend>: Sized {
|
||||
fn read_bytes<T>(&self, ptr: StoragePtr<T>) -> Result<Option<Vec<u8>>, GenericError>;
|
||||
|
||||
fn get_backend(&self) -> Weak<RefCell<SB>>;
|
||||
@@ -64,7 +64,7 @@ pub trait StorageReader<'a, SB: StorageBackend>: Sized {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait StorageTxMut<'a, SB: StorageBackend>: StorageReader<'a, SB> + Sized {
|
||||
pub trait StorageTxMut<SB: StorageBackend>: StorageReader<SB> + Sized {
|
||||
fn ref_deltas(&mut self) -> &mut HashMap<(u64, u64, u64), i64>;
|
||||
fn cache(&mut self) -> &mut HashMap<RcKey, StorageEntryPtr>;
|
||||
fn write_bytes<T>(
|
||||
|
||||
@@ -46,7 +46,7 @@ impl DecoderMaker for Rc<Bytecode> {
|
||||
}
|
||||
|
||||
impl<SB: StorageBackend> StorageEntity<SB> for Bytecode {
|
||||
fn to_storage_entry<'a, TxMut: StorageTxMut<'a, SB>>(
|
||||
fn to_storage_entry<TxMut: StorageTxMut<SB>>(
|
||||
&self,
|
||||
_tx: &mut TxMut,
|
||||
) -> Result<storage::StorageEntry, GenericError> {
|
||||
@@ -57,7 +57,7 @@ impl<SB: StorageBackend> StorageEntity<SB> for Bytecode {
|
||||
})
|
||||
}
|
||||
|
||||
fn from_storage_entry<'a, Tx: StorageReader<'a, SB>>(
|
||||
fn from_storage_entry<Tx: StorageReader<SB>>(
|
||||
_tx: &mut Tx,
|
||||
entry: storage::StorageEntry,
|
||||
) -> Result<Self, GenericError> {
|
||||
|
||||
@@ -48,7 +48,7 @@ impl Tag {
|
||||
}
|
||||
|
||||
impl<SB: StorageBackend + 'static> StorageEntity<SB> for Val {
|
||||
fn from_storage_entry<'a, Tx: StorageReader<'a, SB>>(
|
||||
fn from_storage_entry<Tx: StorageReader<SB>>(
|
||||
tx: &mut Tx,
|
||||
entry: StorageEntry,
|
||||
) -> Result<Self, GenericError> {
|
||||
@@ -63,7 +63,7 @@ impl<SB: StorageBackend + 'static> StorageEntity<SB> for Val {
|
||||
res
|
||||
}
|
||||
|
||||
fn to_storage_entry<'a, TxMut: StorageTxMut<'a, SB>>(
|
||||
fn to_storage_entry<'a, TxMut: StorageTxMut<SB>>(
|
||||
&self,
|
||||
tx: &mut TxMut,
|
||||
) -> Result<StorageEntry, GenericError> {
|
||||
@@ -158,7 +158,7 @@ impl<SB: StorageBackend + 'static> StorageEntity<SB> for Val {
|
||||
}
|
||||
}
|
||||
|
||||
fn write_to_entry<'a, SB: StorageBackend + 'static, Tx: StorageTxMut<'a, SB>>(
|
||||
fn write_to_entry<SB: StorageBackend + 'static, Tx: StorageTxMut<SB>>(
|
||||
val: &Val,
|
||||
tx: &mut Tx,
|
||||
writer: &mut StorageEntryWriter,
|
||||
@@ -248,7 +248,7 @@ fn write_to_entry<'a, SB: StorageBackend + 'static, Tx: StorageTxMut<'a, SB>>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_ptr_to_entry<'a, SB: StorageBackend + 'static, Tx: StorageTxMut<'a, SB>>(
|
||||
fn write_ptr_to_entry<SB: StorageBackend + 'static, Tx: StorageTxMut<SB>>(
|
||||
tx: &mut Tx,
|
||||
writer: &mut StorageEntryWriter,
|
||||
key: RcKey,
|
||||
@@ -266,7 +266,7 @@ fn write_ptr_to_entry<'a, SB: StorageBackend + 'static, Tx: StorageTxMut<'a, SB>
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_from_entry<'a, SB: StorageBackend + 'static, Tx: StorageReader<'a, SB>>(
|
||||
fn read_from_entry<SB: StorageBackend + 'static, Tx: StorageReader<SB>>(
|
||||
tx: &mut Tx,
|
||||
reader: &mut StorageEntryReader,
|
||||
) -> Result<Val, GenericError> {
|
||||
@@ -399,7 +399,7 @@ fn read_symbol_from_entry(reader: &mut StorageEntryReader) -> Result<VsSymbol, B
|
||||
Ok(FromPrimitive::from_usize(reader.read_vlq()?).unwrap())
|
||||
}
|
||||
|
||||
fn read_ref_bytecode_from_entry<'a, SB: StorageBackend, Tx: StorageReader<'a, SB>>(
|
||||
fn read_ref_bytecode_from_entry<SB: StorageBackend, Tx: StorageReader<SB>>(
|
||||
tx: &mut Tx,
|
||||
reader: &mut StorageEntryReader,
|
||||
) -> Result<Rc<Bytecode>, GenericError> {
|
||||
@@ -410,7 +410,7 @@ fn read_ref_bytecode_from_entry<'a, SB: StorageBackend, Tx: StorageReader<'a, SB
|
||||
Ok(Rc::new(Bytecode::from_storage_entry(tx, entry)?))
|
||||
}
|
||||
|
||||
fn write_ref_bytecode_to_entry<'a, SB: StorageBackend, Tx: StorageTxMut<'a, SB>>(
|
||||
fn write_ref_bytecode_to_entry<SB: StorageBackend, Tx: StorageTxMut<SB>>(
|
||||
tx: &mut Tx,
|
||||
writer: &mut StorageEntryWriter,
|
||||
bytecode: &Rc<Bytecode>,
|
||||
|
||||
Reference in New Issue
Block a user