pub trait DataTypeFunctionswhere
    Self: Send + Sized,
{ fn free(self: Box<Self>) { ... } fn mark(&self) { ... } fn size(&self) -> usize { ... } fn compact(&self) { ... } }
Expand description

A helper trait used to define functions associated with a DataType.

Provided Methods§

Called when the Ruby wrapper object is garbage collected.

This can be implemented to perform Ruby-specific clean up when your type is no longer referenced from Ruby, but it is likely easier to do this in a Drop implementation for your type.

The default implementation simply drops self.

This function must not panic. The process will abort if this function panics.

Called when Ruby marks this object as part of garbage collection.

If your type contains any Ruby values you must mark each of those values in this function to avoid them being garbage collected.

The default implementation does nothing.

This function must not panic. The process will abort if this function panics.

Called by Ruby to establish the memory size of this data, to optimise when garbage collection happens.

The default implementation delegates to std::mem::size_of_val.

This function must not panic. The process will abort if this function panics.

Called during garbage collection.

If your type contains any Ruby values that have been marked as moveable you must update them in this function.

The default implementation does nothing.

This function must not panic. The process will abort if this function panics.

Implementors§