[−][src]Enum sanakirja::value::UnsafeValue
Unsafe values, the unsafe representation of a value.
Variants
Direct
A "direct" value, i.e. a value stored inline in tree pages. These values are limited to at most 506 bytes.
Fields of Direct
Large
A "large" value, stored on a linked list of pages.
Fields of Large
Methods
impl UnsafeValue
[src]
pub fn len(&self) -> u64
[src]
Length of this unsafe value
pub unsafe fn as_slice<'a>(&self) -> &'a [u8]
[src]
Unsafely turn this value into a slice, if it is inlined on a page. Panics else.
pub fn from_slice(slice: &[u8]) -> UnsafeValue
[src]
Converts a slice of bytes into an unsafe value.
pub fn alloc_if_needed<T>(
txn: &mut MutTxn<T>,
value: &[u8]
) -> Result<UnsafeValue, Error>
[src]
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 Representable for UnsafeValue
[src]
fn onpage_size(&self) -> u16
[src]
unsafe fn write_value(&self, ptr: *mut u8)
[src]
unsafe fn read_value(ptr: *const u8) -> Self
[src]
unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, y: Self) -> Ordering
[src]
fn drop_value<T, R>(&self, txn: &mut MutTxn<T>, _: &mut R) -> Result<(), Error>
[src]
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 more
fn page_offsets(&self) -> Self::PageOffsets
[src]
fn alignment() -> Alignment
[src]
Alignment of this type. Allowed values are 1, 2, 4 and 8.
unsafe fn skip(p: *mut u8) -> *mut u8
[src]
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
impl Clone for UnsafeValue
[src]
fn clone(&self) -> UnsafeValue
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for UnsafeValue
[src]
impl Debug for UnsafeValue
[src]
Auto Trait Implementations
impl !Sync for UnsafeValue
impl Unpin for UnsafeValue
impl !Send for UnsafeValue
impl UnwindSafe for UnsafeValue
impl RefUnwindSafe for UnsafeValue
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,