Enum sanakirja::value::UnsafeValue
source · pub enum UnsafeValue {
// some variants omitted
}
Expand description
Unsafe values, the unsafe representation of a value.
Implementations
sourceimpl UnsafeValue
impl UnsafeValue
sourcepub unsafe fn as_slice<'a>(&self) -> &'a [u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub unsafe fn as_slice<'a>(&self) -> &'a [u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[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
sourceimpl Clone for UnsafeValue
impl Clone for UnsafeValue
sourcefn clone(&self) -> UnsafeValue
fn clone(&self) -> UnsafeValue
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for UnsafeValue
impl Debug for UnsafeValue
sourceimpl Representable for UnsafeValue
impl Representable for UnsafeValue
sourcefn onpage_size(&self) -> u16
fn onpage_size(&self) -> u16
How much space this value occupies on the page (not counting alignment padding).
sourceunsafe 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()
.sourceunsafe 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()
.sourceunsafe 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
sourcefn 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 moresourcefn 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 moreimpl Copy for UnsafeValue
Auto Trait Implementations
impl RefUnwindSafe for UnsafeValue
impl !Send for UnsafeValue
impl !Sync for UnsafeValue
impl Unpin for UnsafeValue
impl UnwindSafe for UnsafeValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more