Trait sanakirja::UnsizedStorable[][src]

pub trait UnsizedStorable: Storable {
    const ALIGN: usize;

    fn size(&self) -> usize;
unsafe fn onpage_size(*const u8) -> usize;
unsafe fn write_to_page(&self, p: *mut u8);
unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a Self; }
Expand description

Types that can be stored on disk.

Associated Constants

Required methods

fn size(&self) -> usize[src]

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

unsafe fn onpage_size(*const u8) -> usize[src]

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

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

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

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

Implementations on Foreign Types

impl UnsizedStorable for u32[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u32[src]

impl UnsizedStorable for i32[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i32[src]

impl UnsizedStorable for u16[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u16[src]

impl UnsizedStorable for [u8; 16][src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a [u8; 16][src]

impl UnsizedStorable for u8[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u8[src]

impl UnsizedStorable for u64[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u64[src]

impl UnsizedStorable for i16[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i16[src]

impl UnsizedStorable for i8[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i8[src]

impl UnsizedStorable for ()[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a ()[src]

impl UnsizedStorable for i64[src]

pub fn size(&self) -> usize[src]

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

pub unsafe fn onpage_size(*const u8) -> usize[src]

Read the size from an on-page entry.

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

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

pub const ALIGN: usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i64[src]

impl UnsizedStorable for [u8][src]

pub const ALIGN: usize[src]

pub fn size(&self) -> usize[src]

pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a [u8][src]

pub unsafe fn onpage_size(p: *const u8) -> usize[src]

pub unsafe fn write_to_page(&self, p: *mut u8)[src]

Implementors