[][src]Trait sanakirja::Representable

pub trait Representable: Copy + Debug {
    type PageOffsets: Iterator<Item = u64>;
    pub fn onpage_size(&self) -> u16;
pub unsafe fn write_value(&self, p: *mut u8);
pub unsafe fn read_value(p: *const u8) -> Self;
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering;
pub fn page_offsets(&self) -> Self::PageOffsets; pub fn alignment() -> Alignment { ... }
pub unsafe fn skip(p: *mut u8) -> *mut u8 { ... }
pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R: Rng>(
        &self,
        _: &mut MutTxn<E, T>,
        _: &mut R
    ) -> Result<(), Error> { ... } }

Types that can be stored in a Sanakirja database, as keys or values. Some care must be taken when storing things.

Associated Types

type PageOffsets: Iterator<Item = u64>[src]

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.

Loading content...

Required methods

pub fn onpage_size(&self) -> u16[src]

How much space this value occupies on the page (not counting alignment padding).

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

Write this value to a u8 pointer, guaranteed to be a multiple of self.alignment().

pub unsafe fn read_value(p: *const u8) -> Self[src]

Read value from an onpage pointer, guaranteed to be a multiple of self.alignment().

pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering[src]

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.

pub fn page_offsets(&self) -> Self::PageOffsets[src]

If this value is an offset to another page at offset offset, return Some(offset). Return None else.

Loading content...

Provided methods

pub fn alignment() -> Alignment[src]

Alignment of this type. Allowed values are 1, 2, 4 and 8.

pub 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.

pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R: Rng>(
    &self,
    _: &mut MutTxn<E, T>,
    _: &mut R
) -> Result<(), Error>
[src]

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.

Loading content...

Implementations on Foreign Types

impl<A: Representable, B: Representable> Representable for (A, B)[src]

type PageOffsets = Chain<A::PageOffsets, B::PageOffsets>

impl<A: Representable, B: Representable, C: Representable> Representable for (A, B, C)[src]

type PageOffsets = Chain<Chain<A::PageOffsets, B::PageOffsets>, C::PageOffsets>

impl<A: Representable, B: Representable, C: Representable, D: Representable> Representable for (A, B, C, D)[src]

type PageOffsets = Chain<Chain<A::PageOffsets, B::PageOffsets>, Chain<C::PageOffsets, D::PageOffsets>>

impl<A: Representable, B: Representable, C: Representable, D: Representable, E: Representable> Representable for (A, B, C, D, E)[src]

type PageOffsets = Chain<Chain<Chain<Chain<A::PageOffsets, B::PageOffsets>, C::PageOffsets>, D::PageOffsets>, E::PageOffsets>

impl<A: Representable, B: Representable, C: Representable, D: Representable, E: Representable, F: Representable> Representable for (A, B, C, D, E, F)[src]

type PageOffsets = Chain<Chain<Chain<Chain<Chain<A::PageOffsets, B::PageOffsets>, C::PageOffsets>, D::PageOffsets>, E::PageOffsets>, F::PageOffsets>

impl Representable for f64[src]

type PageOffsets = Empty<u64>

impl Representable for u64[src]

type PageOffsets = Empty<u64>

impl Representable for u32[src]

type PageOffsets = Empty<u64>

impl Representable for i64[src]

type PageOffsets = Empty<u64>

impl Representable for i32[src]

type PageOffsets = Empty<u64>

impl Representable for ()[src]

type PageOffsets = Empty<u64>

impl Representable for Uuid[src]

type PageOffsets = Empty<u64>

impl Representable for Oid[src]

type PageOffsets = Empty<u64>

Loading content...

Implementors

impl Representable for UnsafeValue[src]

type PageOffsets = IntoIter<u64>

impl<K: Representable, V: Representable> Representable for Db<K, V>[src]

type PageOffsets = Once<u64>

Loading content...