Struct jlrs::CCall[][src]

pub struct CCall { /* fields omitted */ }
Expand description

When you call Rust from Julia through ccall, Julia has already been initialized and trying to initialize it again would cause a crash. In order to still be able to call Julia from Rust and to borrow arrays (if you pass them as Array rather than Ptr{Array}), you’ll need to create a frame first. You can use this struct to do so. It must never be used outside functions called through ccall, and only once for each ccalled function.

If you only need to use a frame to borrow array data, you can use CCall::null_scope. Unlike Julia, CCall postpones the allocation of the stack that is used for managing the GC until a GcFrame is created. In the case of a null scope, this stack isn’t allocated at all.

Implementations

Create a new CCall. This function must never be called outside a function called through ccall from Julia and must only be called once during that call. The stack is not allocated until a GcFrame is created.

Wake the task associated with handle. The handle must be the handle field of a Base.AsyncCondition in Julia. This can be used to call a long-running Rust function from Julia with ccall in another thread and wait for it to complete in Julia without blocking, there’s an example available in the repository: ccall_with_threads.

Creates a GcFrame, calls the given closure, and returns its result.

Creates a GcFrame with slots slots, calls the given closure, and returns its result.

Create a NullFrame and call the given closure. A NullFrame cannot be nested and can only be used to (mutably) borrow array data. Unlike other scope-methods, no Global is provided to the closure.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.