Enum sanakirja::value::UnsafeValue
[−]
[src]
pub enum UnsafeValue { // some variants omitted }
Unsafe values, the unsafe representation of a value.
Methods
impl UnsafeValue
[src]
fn len(&self) -> u64
Length of this unsafe value
unsafe fn as_slice<'a>(&self) -> &'a [u8]
Unsafely turn this value into a slice, if it is inlined on a page. Panics else.
fn from_slice(slice: &[u8]) -> UnsafeValue
Converts a slice of bytes into an unsafe value.
fn alloc_if_needed<T>(
txn: &mut MutTxn<T>,
value: &[u8]
) -> Result<UnsafeValue, Error>
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
impl Clone for UnsafeValue
[src]
fn clone(&self) -> UnsafeValue
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for UnsafeValue
[src]
impl Debug for UnsafeValue
[src]
impl Representable for UnsafeValue
[src]
fn onpage_size(&self) -> u16
How much space this value occupies on the page (not counting alignment padding).
unsafe fn write_value(&self, ptr: *mut u8)
Write this value to a u8 pointer, guaranteed to be a multiple of self.alignment()
.
unsafe fn read_value(ptr: *const u8) -> Self
Read value from an onpage pointer, guaranteed to be a multiple of self.alignment()
.
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
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 = Once<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 more
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
fn alignment() -> Alignment
Alignment of this type. Allowed values are 1, 2, 4 and 8.
unsafe fn skip(p: *mut u8) -> *mut u8
First pointer strictly after this value's pointer. The default implementation is basically p.offset(self.onpage_size() as isize)
, but their might be more efficient implementations in some cases. Read more