Struct kdb::KBox[][src]

#[repr(transparent)]pub struct KBox<T: KObject> { /* fields omitted */ }

Represents a memory managed K pointer. They are the KDB equivalent of a Rust Box, a zero overhead wrapper around a K pointer. It will call r0 to decrement the reference count when it is dropped.

Implementations

impl<T: KValue> KBox<Atom<T>>[src]

pub fn new_atom(value: T) -> KBox<Atom<T>>[src]

Creates a new atom with the specified value.

impl KBox<Dictionary>[src]

pub fn new_dict() -> Self[src]

Create a new empty dictionary.

impl KBox<KError>[src]

pub fn new_error(msg: &str) -> Self[src]

Create a new KDB error from the specified string.

impl<T: KObject> KBox<T>[src]

pub fn into_raw(self) -> *mut T[src]

Converts a box into a raw unmanged K pointer. Note that into raw will consume the KBox, and not call r0, so it's possible to leak memory by doing this.

pub unsafe fn from_raw(k: *mut K) -> Self[src]

Converts a raw K pointer into a boxed K object. This is the reciprocal of into_raw

Safety

The type of the k pointer must match the type of the KBox being used. Do not use this to take ownership of a kdb callback function parameter, use from_shared instead.

pub unsafe fn from_shared(t: &mut T) -> Self[src]

Takes a reference and calls r1, incrementing the reference count and "re-boxing" it. Typically this is a bad thing as you have multiple owned references and kdb does not provide equivalent guarantees to rust about what happens to shared references (especially when reallocating a list for example)

However in the embedded case, where you do not own the parameter and you wish to manipulate it without copying the data, then you need this functionality.

Safety

A reference should not be owned by more than one KBox instance.

impl<T: KListable> KBox<List<T>>[src]

pub fn new_list() -> Self[src]

Creates a new empty list.

Note that if you are converting a rust collection to a list, collect is a more efficient. If you are creating a list with a set of known elements, use the list! macro.

pub fn join(&mut self, list: KBox<List<T>>)[src]

Appends a list to this one, consuming it and adding it's elements to the new one.

pub fn push(&mut self, item: T::ListItem)[src]

Appends an element to the end of the list.

Trait Implementations

impl<T: KObject> AsRef<T> for KBox<T>[src]

impl<T: KObject + Debug> Debug for KBox<T>[src]

impl<T: KObject> Deref for KBox<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: KObject> DerefMut for KBox<T>[src]

impl<T: KObject + Display> Display for KBox<T>[src]

impl<T: KObject> Drop for KBox<T>[src]

impl<T: Eq + KObject> Eq for KBox<T>[src]

impl<T: KListable> Extend<<T as KListable>::ListItem> for KBox<List<T>>[src]

impl<T: KValue> From<KBox<Atom<T>>> for KBox<Any>[src]

impl From<KBox<Dictionary>> for KBox<Any>[src]

impl From<KBox<KError>> for Error[src]

impl<T: KListable> From<KBox<List<T>>> for KBox<Any>[src]

impl From<KBox<Table>> for KBox<Any>[src]

impl<T: KValue> From<T> for KBox<Any>[src]

impl<T: KValue> From<T> for KBox<Atom<T>>[src]

impl<T: KListable> FromIterator<<T as KListable>::ListItem> for KBox<List<T>>[src]

impl<T: Hash + KObject> Hash for KBox<T>[src]

impl<T: Ord + KObject> Ord for KBox<T>[src]

impl<T: PartialEq + KObject> PartialEq<KBox<T>> for KBox<T>[src]

impl<T: PartialOrd + KObject> PartialOrd<KBox<T>> for KBox<T>[src]

impl<T: KObject> StructuralEq for KBox<T>[src]

impl<T: KObject> StructuralPartialEq for KBox<T>[src]

impl<T> TryFrom<KBox<Any>> for KBox<Atom<T>> where
    T: KValue, 
[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<T> TryFrom<KBox<Any>> for KBox<List<T>> where
    T: KListable, 
[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<KBox<Any>> for KBox<Dictionary>[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<KBox<Any>> for KBox<Table>[src]

type Error = ConversionError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<T> RefUnwindSafe for KBox<T> where
    T: RefUnwindSafe
[src]

impl<T> !Send for KBox<T>[src]

impl<T> !Sync for KBox<T>[src]

impl<T> Unpin for KBox<T>[src]

impl<T> UnwindSafe for KBox<T> where
    T: RefUnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.