add TransactionHandle::set
This commit is contained in:
parent
1383d615de
commit
238b00348e
@ -41,6 +41,7 @@ impl Str {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove these impls for all datatypes
|
||||||
impl FilePointer<Str> {
|
impl FilePointer<Str> {
|
||||||
pub fn set<R>(self, transaction: &mut TransactionHandle<R>, s: &str) -> FilePointer<Str> {
|
pub fn set<R>(self, transaction: &mut TransactionHandle<R>, s: &str) -> FilePointer<Str> {
|
||||||
let new_str = transaction.read::<Str>(self).set(transaction, s);
|
let new_str = transaction.read::<Str>(self).set(transaction, s);
|
||||||
|
@ -136,6 +136,12 @@ impl<'t, R> TransactionHandle<'t, R> {
|
|||||||
(FilePointer::from_range(range), data)
|
(FilePointer::from_range(range), data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set<T: AsBytes + FromBytes>(&mut self, at: FilePointer<T>, value: T) -> FilePointer<T> {
|
||||||
|
let (ptr, data) = self.modify(at);
|
||||||
|
*data = value;
|
||||||
|
ptr
|
||||||
|
}
|
||||||
|
|
||||||
pub fn allocate_range(&mut self, length: u64) -> (FileRange, &mut [u8]) {
|
pub fn allocate_range(&mut self, length: u64) -> (FileRange, &mut [u8]) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let range = self.db.allocate(length);
|
let range = self.db.allocate(length);
|
||||||
|
Loading…
Reference in New Issue
Block a user