pub struct Object<Base> { /* private fields */ }
Implementations§
Source§impl<Base> Object<Base>
impl<Base> Object<Base>
Sourcepub fn into_tx(self) -> Result<TxObject<Base>>
pub fn into_tx(self) -> Result<TxObject<Base>>
Start a transaction on this object, turning this object into a transaction object handle.
§Example
let obj = ObjectBuilder::new().build(12u32).unwrap();
let tx_obj = obj.into_tx().unwrap();
tx_obj.base_mut() += 1;
Sourcepub fn as_tx(&self) -> Result<TxObject<Base>>
pub fn as_tx(&self) -> Result<TxObject<Base>>
Start a transaction on this object, creating a new transaction object handle.
§Example
let obj = ObjectBuilder::new().build(12u32).unwrap();
let tx_obj = obj.as_tx().unwrap();
tx_obj.base_mut() += 1;
Sourcepub fn with_tx<R>(
&mut self,
f: impl FnOnce(&mut TxObject<Base>) -> Result<R>,
) -> Result<R>
pub fn with_tx<R>( &mut self, f: impl FnOnce(&mut TxObject<Base>) -> Result<R>, ) -> Result<R>
Perform a transaction on this object, within the provided closure.
§Example
let obj = ObjectBuilderrstarst::new().build(12u32).unwrap();
obj.with_tx(|tx| tx.base_mut() += 1).unwrap();
Sourcepub unsafe fn as_mut(&self) -> Result<MutObject<Base>>
pub unsafe fn as_mut(&self) -> Result<MutObject<Base>>
Create a new mutable object handle from this object.
§Safety
The caller must ensure that the underlying object is not changed outside of this mapping.
Sourcepub unsafe fn into_mut(self) -> Result<MutObject<Base>>
pub unsafe fn into_mut(self) -> Result<MutObject<Base>>
Create a new mutable object handle from this object.
§Safety
The caller must ensure that the underlying object is not changed outside of this mapping.
pub unsafe fn from_handle_unchecked(handle: ObjectHandle) -> Self
pub fn from_handle(handle: ObjectHandle) -> Result<Self>
pub fn into_handle(self) -> ObjectHandle
pub unsafe fn cast<U>(self) -> Object<U>
Sourcepub fn map(id: ObjID, flags: MapFlags) -> Result<Self>
pub fn map(id: ObjID, flags: MapFlags) -> Result<Self>
Open a new object from its ID.
The provided map flags must contain at least READ, and for stable read maps, INDIRECT. For writes, add WRITE and PERSIST.
This function checks the underlying fingerprint of the base type against the stored value and fails on mismatch to ensure type safety.