Struct kdb::KBox [−][src]
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]
impl KBox<Dictionary>
[src]
impl KBox<KError>
[src]
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]
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]
fn extend<I: IntoIterator<Item = T::ListItem>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: KValue> From<KBox<Atom<T>>> for KBox<Any>
[src]
impl From<KBox<Dictionary>> for KBox<Any>
[src]
fn from(value: KBox<Dictionary>) -> Self
[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]
fn from_iter<I: IntoIterator<Item = T::ListItem>>(iter: I) -> Self
[src]
impl<T: Hash + KObject> Hash for KBox<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord + KObject> Ord for KBox<T>
[src]
fn cmp(&self, other: &KBox<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq + KObject> PartialEq<KBox<T>> for KBox<T>
[src]
impl<T: PartialOrd + KObject> PartialOrd<KBox<T>> for KBox<T>
[src]
fn partial_cmp(&self, other: &KBox<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[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]
T: KValue,
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(any: KBox<Any>) -> Result<Self, Self::Error>
[src]
impl<T> TryFrom<KBox<Any>> for KBox<List<T>> where
T: KListable,
[src]
T: KListable,
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(any: KBox<Any>) -> Result<Self, Self::Error>
[src]
impl TryFrom<KBox<Any>> for KBox<Dictionary>
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(any: KBox<Any>) -> Result<Self, Self::Error>
[src]
impl TryFrom<KBox<Any>> for KBox<Table>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for KBox<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
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]
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,