Enum sanakirja::value::UnsafeValue
source · pub enum UnsafeValue {
// some variants omitted
}
Expand description
Unsafe values, the unsafe representation of a value.
Implementations§
source§impl UnsafeValue
impl UnsafeValue
sourcepub unsafe fn as_slice<'a>(&self) -> &'a [u8] ⓘ
pub unsafe fn as_slice<'a>(&self) -> &'a [u8] ⓘ
Unsafely turn this value into a slice, if it is inlined on a page. Panics else.
sourcepub fn from_slice(slice: &[u8]) -> UnsafeValue
pub fn from_slice(slice: &[u8]) -> UnsafeValue
Converts a slice of bytes into an unsafe value.
sourcepub fn alloc_if_needed<T>(
txn: &mut MutTxn<'_, T>,
value: &[u8]
) -> Result<UnsafeValue, Error>
pub fn alloc_if_needed<T>(
txn: &mut MutTxn<'_, T>,
value: &[u8]
) -> Result<UnsafeValue, Error>
Allocates a large value if needed, or else return a pointer to the given slice.
Trait Implementations§
source§impl Clone for UnsafeValue
impl Clone for UnsafeValue
source§fn clone(&self) -> UnsafeValue
fn clone(&self) -> UnsafeValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UnsafeValue
impl Debug for UnsafeValue
source§impl Representable for UnsafeValue
impl Representable for UnsafeValue
source§fn onpage_size(&self) -> u16
fn onpage_size(&self) -> u16
How much space this value occupies on the page (not counting alignment padding).
source§unsafe fn write_value(&self, ptr: *mut u8)
unsafe fn write_value(&self, ptr: *mut u8)
Write this value to a u8 pointer, guaranteed to be a multiple of
self.alignment()
.source§unsafe fn read_value(ptr: *const u8) -> Self
unsafe fn read_value(ptr: *const u8) -> Self
Read value from an onpage pointer, guaranteed to be a multiple of
self.alignment()
.source§unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, y: Self) -> Ordering
unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, y: Self) -> Ordering
Compare a value with an onpage value. The current transaction
is sometimes helpful, for instance when the page only stores a
pointer to another page. Read more
source§fn drop_value<T, R>(
&self,
txn: &mut MutTxn<'_, T>,
_: &mut R
) -> Result<(), Error>
fn drop_value<T, R>(
&self,
txn: &mut MutTxn<'_, T>,
_: &mut R
) -> Result<(), Error>
How to free the pages used by this value. The default
implementation doesn’t do anything, which is fine for types
stored directly on B tree pages. Read more
§type PageOffsets = IntoIter<u64>
type PageOffsets = IntoIter<u64>
An iterator over the offsets to pages contained in this
value. Only values from this crate can generate non-empty
iterators, but combined values (like tuples) must chain the
iterators returned by method
page_offsets
. Read moresource§fn page_offsets(&self) -> Self::PageOffsets
fn page_offsets(&self) -> Self::PageOffsets
If this value is an offset to another page at offset
offset
,
return Some(offset)
. Return None
else. Read more