Trait sdb::UnsizedStorable [−]
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
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
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.
unsafe fn write_to_page(&self, p: *mut u8)
unsafe fn write_to_page(&self, p: *mut u8)
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
Implementations on Foreign Types
impl UnsizedStorable for i16
impl UnsizedStorable for i16
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i16
impl UnsizedStorable for [u8]
impl UnsizedStorable for [u8]
impl UnsizedStorable for u64
impl UnsizedStorable for u64
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u64
impl UnsizedStorable for u8
impl UnsizedStorable for u8
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u8
impl UnsizedStorable for u16
impl UnsizedStorable for u16
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u16
impl UnsizedStorable for u32
impl UnsizedStorable for u32
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a u32
impl UnsizedStorable for [u8; 16]
impl UnsizedStorable for [u8; 16]
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
impl UnsizedStorable for i8
impl UnsizedStorable for i8
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i8
impl UnsizedStorable for i32
impl UnsizedStorable for i32
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i32
impl UnsizedStorable for ()
impl UnsizedStorable for ()
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a ()
impl UnsizedStorable for i64
impl UnsizedStorable for i64
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
pub unsafe fn onpage_size(*const u8) -> usize
Read the size from an on-page entry.
pub unsafe fn write_to_page(&self, p: *mut u8)
pub unsafe fn write_to_page(&self, p: *mut u8)
Write to a page. Must not overwrite the allocated size, but this isn’t checked (which is why it’s unsafe).
pub unsafe fn from_raw_ptr<'a, T>(&T, p: *const u8) -> &'a i64