pub trait UnsizedStorable: Storable {
    const ALIGN: usize;

    // Required methods
    fn size(&self) -> usize;
    unsafe fn onpage_size(_: *const u8) -> usize;
    unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self;

    // Provided methods
    unsafe fn write_to_page(&self, _: *mut u8) { ... }
    unsafe fn write_to_page_alloc<T: AllocPage>(&self, _: &mut T, p: *mut u8) { ... }
}
Expand description

Types that can be stored on disk.

Required Associated Constants§

Required Methods§

source

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry. If Self::SIZE.is_some() this must be the same value.

source

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

Provided Methods§

source

unsafe fn write_to_page(&self, _: *mut u8)

Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).

source

unsafe fn write_to_page_alloc<T: AllocPage>(&self, _: &mut T, p: *mut u8)

Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).

This is similar to write_to_page, but allows the user to allocate a value as needed when inserting the value into the base; do not implement both methods, since only write_to_page_alloc gets called by the library.

The default implementation just calls write_to_page.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl UnsizedStorable for i8

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 1usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for i16

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 2usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for i32

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 4usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for i64

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 8usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for u8

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 1usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for u16

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 2usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for u32

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 4usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for u64

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 8usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for ()

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 1usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for [u8; 16]

source§

fn size(&self) -> usize

If Self::SIZE.is_some(), this must return the same value. The default implementation is Self;:SIZE.unwrap().

source§

unsafe fn onpage_size(_: *const u8) -> usize

Read the size from an on-page entry.

source§

const ALIGN: usize = 1usize

source§

unsafe fn write_to_page(&self, p: *mut u8)

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

impl UnsizedStorable for [u8]

source§

const ALIGN: usize = 2usize

source§

fn size(&self) -> usize

source§

unsafe fn from_raw_ptr<'a, T>(_: &T, p: *const u8) -> &'a Self

source§

unsafe fn onpage_size(p: *const u8) -> usize

source§

unsafe fn write_to_page_alloc<T: AllocPage>(&self, _txn: &mut T, p: *mut u8)

Implementors§

source§

impl<'b> UnsizedStorable for Slice<'b>

source§

const ALIGN: usize = 8usize