[−][src]Trait sanakirja::Representable
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
.
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.
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]
&self,
_: &mut MutTxn<E, T>,
_: &mut R
) -> Result<(), Error>
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.
Implementations on Foreign Types
impl<A: Representable, B: Representable> Representable for (A, B)
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering
[src]
type PageOffsets = Chain<A::PageOffsets, B::PageOffsets>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R: Rng>(
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
impl<A: Representable, B: Representable, C: Representable> Representable for (A, B, C)
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering
[src]
type PageOffsets = Chain<Chain<A::PageOffsets, B::PageOffsets>, C::PageOffsets>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R: Rng>(
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
impl<A: Representable, B: Representable, C: Representable, D: Representable> Representable for (A, B, C, D)
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering
[src]
type PageOffsets = Chain<Chain<A::PageOffsets, B::PageOffsets>, Chain<C::PageOffsets, D::PageOffsets>>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R: Rng>(
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
impl<A: Representable, B: Representable, C: Representable, D: Representable, E: Representable> Representable for (A, B, C, D, E)
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering
[src]
type PageOffsets = Chain<Chain<Chain<Chain<A::PageOffsets, B::PageOffsets>, C::PageOffsets>, D::PageOffsets>, E::PageOffsets>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
pub fn drop_value<Env_: Borrow<Env<Exclusive>>, T, R: Rng>(
&self,
txn: &mut MutTxn<Env_, T>,
rng: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<Env_, T>,
rng: &mut R
) -> Result<(), Error>
impl<A: Representable, B: Representable, C: Representable, D: Representable, E: Representable, F: Representable> Representable for (A, B, C, D, E, F)
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, x: Self) -> Ordering
[src]
type PageOffsets = Chain<Chain<Chain<Chain<Chain<A::PageOffsets, B::PageOffsets>, C::PageOffsets>, D::PageOffsets>, E::PageOffsets>, F::PageOffsets>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
pub fn drop_value<Env_: Borrow<Env<Exclusive>>, T, R: Rng>(
&self,
txn: &mut MutTxn<Env_, T>,
rng: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<Env_, T>,
rng: &mut R
) -> Result<(), Error>
impl Representable for f64
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, x: Self) -> Ordering
[src]
type PageOffsets = Empty<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
impl Representable for u64
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, x: Self) -> Ordering
[src]
type PageOffsets = Empty<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
impl Representable for u32
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, x: Self) -> Ordering
[src]
type PageOffsets = Empty<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
impl Representable for i64
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, x: Self) -> Ordering
[src]
type PageOffsets = Empty<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
impl Representable for i32
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, x: Self) -> Ordering
[src]
type PageOffsets = Empty<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
impl Representable for ()
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, _: *mut u8)
[src]
pub unsafe fn read_value(_: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, _: Self) -> Ordering
[src]
type PageOffsets = Empty<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
Implementors
impl Representable for UnsafeValue
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn write_value(&self, ptr: *mut u8)
[src]
pub unsafe fn read_value(ptr: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, txn: &T, y: Self) -> Ordering
[src]
pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R>(
&self,
txn: &mut MutTxn<E, T>,
_: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<E, T>,
_: &mut R
) -> Result<(), Error>
type PageOffsets = IntoIter<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
impl<K: Representable, V: Representable> Representable for Db<K, V>
[src]
pub fn alignment() -> Alignment
[src]
pub fn onpage_size(&self) -> u16
[src]
pub unsafe fn skip(p: *mut u8) -> *mut u8
[src]
pub unsafe fn write_value(&self, p: *mut u8)
[src]
pub unsafe fn read_value(p: *const u8) -> Self
[src]
pub unsafe fn cmp_value<T: LoadPage>(&self, _: &T, x: Db<K, V>) -> Ordering
[src]
type PageOffsets = Once<u64>
pub fn page_offsets(&self) -> Self::PageOffsets
[src]
pub fn drop_value<E: Borrow<Env<Exclusive>>, T, R: Rng>(
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>
[src]
&self,
txn: &mut MutTxn<E, T>,
rng: &mut R
) -> Result<(), Error>