Struct Function

Source
pub struct Function<'scope, 'data> { /* private fields */ }
Expand description

A Julia function.

Implementations§

Source§

impl<'scope, 'data> Function<'scope, 'data>

Source

pub fn datatype(self) -> DataType<'scope>

Returns the DataType of this function. In Julia, every function has its own DataType.

Trait Implementations§

Source§

impl<'scope, 'data> CCallArg for Function<'scope, 'data>

Source§

type CCallArgType = Value<'scope, 'data>

Type constructor for the type taken by the generated Julia function.
Source§

type FunctionArgType = Value<'scope, 'data>

Type constructor for the type taken by the ccalled function.
Source§

impl<'data> Call<'data> for Function<'_, 'data>

Source§

unsafe fn call0<'target, Tgt>( self, target: Tgt, ) -> ValueResult<'target, 'data, Tgt>
where Tgt: Target<'target>,

Call a function with no arguments. Read more
Source§

unsafe fn call_unchecked<'target, 'value, V, Tgt, const N: usize>( self, target: Tgt, args: V, ) -> ValueData<'target, 'data, Tgt>
where V: Values<'value, 'data, N>, Tgt: Target<'target>,

Call a function with any number of arguments. Exceptions are not caught. Read more
Source§

unsafe fn call1<'target, Tgt>( self, target: Tgt, arg0: Value<'_, 'data>, ) -> ValueResult<'target, 'data, Tgt>
where Tgt: Target<'target>,

Call a function with one argument. Read more
Source§

unsafe fn call2<'target, Tgt>( self, target: Tgt, arg0: Value<'_, 'data>, arg1: Value<'_, 'data>, ) -> ValueResult<'target, 'data, Tgt>
where Tgt: Target<'target>,

Call a function with two arguments. Read more
Source§

unsafe fn call3<'target, Tgt>( self, target: Tgt, arg0: Value<'_, 'data>, arg1: Value<'_, 'data>, arg2: Value<'_, 'data>, ) -> ValueResult<'target, 'data, Tgt>
where Tgt: Target<'target>,

Call a function with three arguments. Read more
Source§

unsafe fn call<'target, 'value, V, Tgt, const N: usize>( self, target: Tgt, args: V, ) -> ValueResult<'target, 'data, Tgt>
where V: Values<'value, 'data, N>, Tgt: Target<'target>,

Call a function with an arbitrary number arguments. Read more
Source§

unsafe fn call_tracked<'target, 'value, V, Tgt>( self, target: Tgt, args: V, ) -> JlrsResult<ValueResult<'target, 'data, Tgt>>
where V: AsRef<[Value<'value, 'data>]>, Tgt: Target<'target>,

Call a function with an arbitrary number arguments. Read more
Source§

impl<'data> CallAsync<'data> for Function<'_, 'data>

Source§

unsafe fn call_async<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Creates and schedules a new task with Base.Threads.@spawn, and returns a future that resolves when this task is finished. Read more
Source§

unsafe fn call_async_interactive<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Call a function on another thread with the given arguments. This method uses Base.Threads.@spawn to call the given function on another thread but return immediately. While awaiting the result the async runtime can work on other tasks, the current task resumes after the function call on the other thread completes. Read more
Source§

unsafe fn schedule_async_interactive<'target, 'value, V, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JuliaResult<'target, 'data, Value<'target, 'data>>
where V: Values<'value, 'data, N>,

Does the same thing as CallAsync::call_async, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn schedule_async<'target, 'value, V, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JuliaResult<'target, 'data, Value<'target, 'data>>
where V: Values<'value, 'data, N>,

Does the same thing as CallAsync::call_async, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn call_async_local<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Call a function with the given arguments in an @async block. Like call_async, the function is not called on the main thread, but on a separate thread that handles all tasks created by this method. This method should only be used with functions that do very little computational work but mostly spend their time waiting on IO. Read more
Source§

unsafe fn schedule_async_local<'target, 'value, V, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JuliaResult<'target, 'data, Value<'target, 'data>>
where V: Values<'value, 'data, N>,

Does the same thing as CallAsync::call_async_local, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn call_async_main<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JuliaResult<'target, 'data>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Call a function with the given arguments in an @async block. The task is scheduled on the main thread. This method should only be used with functions that must run on the main thread. The runtime is blocked while this task is active. Read more
Source§

unsafe fn schedule_async_main<'target, 'value, V, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JuliaResult<'target, 'data, Value<'target, 'data>>
where V: Values<'value, 'data, N>,

Does the same thing as CallAsync::call_async_main, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn call_async_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Creates and schedules a new task with Base.Threads.@spawn, and returns a future that resolves when this task is finished. Read more
Source§

unsafe fn schedule_async_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
where V: Values<'value, 'data, N>, Tgt: Target<'target>,

Does the same thing as CallAsync::call_async, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn call_async_interactive_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Call a function on another thread with the given arguments. This method uses Base.Threads.@spawn to call the given function on another thread but return immediately. While awaiting the result the async runtime can work on other tasks, the current task resumes after the function call on the other thread completes. Read more
Source§

unsafe fn schedule_async_interactive_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
where V: Values<'value, 'data, N>, Tgt: Target<'target>,

Does the same thing as CallAsync::call_async, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn call_async_local_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Call a function with the given arguments in an @async block. Like call_async, the function is not called on the main thread, but on a separate thread that handles all tasks created by this method. This method should only be used with functions that do very little computational work but mostly spend their time waiting on IO. Read more
Source§

unsafe fn schedule_async_local_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
where V: Values<'value, 'data, N>, Tgt: Target<'target>,

Does the same thing as CallAsync::call_async_local, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

unsafe fn call_async_main_tracked<'target, 'value, 'life0, 'async_trait, V, const N: usize>( self, frame: &'life0 mut AsyncGcFrame<'target>, args: V, ) -> Pin<Box<dyn Future<Output = JlrsResult<JuliaResult<'target, 'data>>> + 'async_trait>>
where V: Values<'value, 'data, N> + 'async_trait, Self: 'async_trait, 'target: 'async_trait, 'value: 'async_trait, 'life0: 'async_trait,

Call a function with the given arguments in an @async block. The task is scheduled on the main thread. This method should only be used with functions that must run on the main thread. The runtime is blocked while this task is active. Read more
Source§

unsafe fn schedule_async_main_tracked<'target, 'value, V, Tgt, const N: usize>( self, frame: &mut AsyncGcFrame<'target>, args: V, ) -> JlrsResult<JuliaResult<'target, 'data, Value<'target, 'data>>>
where V: Values<'value, 'data, N>, Tgt: Target<'target>,

Does the same thing as CallAsync::call_async_main, but the task is returned rather than an awaitable Future. This method should only be called in PersistentTask::init, otherwise it’s not guaranteed this task can make progress. Read more
Source§

impl<'scope, 'data> Clone for Function<'scope, 'data>

Source§

fn clone(&self) -> Function<'scope, 'data>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ConstructType for Function<'_, '_>

Source§

const CACHEABLE: bool = false

Indicates whether the type might be cacheable. Read more
Source§

type Static = Function<'static, 'static>

Self, but with all lifetimes set to 'static. This ensures Self::Static has a type id.
Source§

fn construct_type_uncached<'target, Tgt>( target: Tgt, ) -> ValueData<'target, 'static, Tgt>
where Tgt: Target<'target>,

Constructs the type object associated with this type.
Source§

fn base_type<'target, Tgt>(target: &Tgt) -> Option<Value<'target, 'static>>
where Tgt: Target<'target>,

Returns the base type object associated with this type. Read more
Source§

fn construct_type_with_env_uncached<'target, Tgt>( target: Tgt, _env: &TypeVarEnv<'_>, ) -> ValueData<'target, 'static, Tgt>
where Tgt: Target<'target>,

Constructs the type object associated with this type. Read more
Source§

fn type_id() -> TypeId

Returns the TypeId of Self::Static.
Source§

fn construct_type<'target, Tgt>(target: Tgt) -> ValueData<'target, 'static, Tgt>
where Tgt: Target<'target>,

Construct the type object and try to cache the result. If a cached entry is available, it is returned.
Source§

fn construct_type_with_env<'target, Tgt>( target: Tgt, env: &TypeVarEnv<'_>, ) -> ValueData<'target, 'static, Tgt>
where Tgt: Target<'target>,

Construct the type object with an environment of TypeVars and try to cache the result. If a cached entry is available, it is returned. Read more
Source§

impl Debug for Function<'_, '_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'value, 'data> ProvideKeywords<'value, 'data> for Function<'value, 'data>

Source§

fn provide_keywords( self, kws: Value<'value, 'data>, ) -> JlrsResult<WithKeywords<'value, 'data>>

Provide keyword arguments to the function. The keyword arguments must be a NamedTuple. Read more
Source§

impl Typecheck for Function<'_, '_>

Source§

fn typecheck(ty: DataType<'_>) -> bool

Returns whether the property implied by Self holds true.
Source§

impl<'scope, 'data> AbstractType for Function<'scope, 'data>

Source§

impl<'scope, 'data> Copy for Function<'scope, 'data>

Auto Trait Implementations§

§

impl<'scope, 'data> Freeze for Function<'scope, 'data>

§

impl<'scope, 'data> RefUnwindSafe for Function<'scope, 'data>

§

impl<'scope, 'data> !Send for Function<'scope, 'data>

§

impl<'scope, 'data> !Sync for Function<'scope, 'data>

§

impl<'scope, 'data> Unpin for Function<'scope, 'data>

§

impl<'scope, 'data> UnwindSafe for Function<'scope, 'data>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'scope, 'data, W> Managed<'scope, 'data> for W
where W: ManagedPriv<'scope, 'data>,

Source§

type InScope<'target> = <W as ManagedPriv<'scope, 'data>>::WithLifetimes<'target, 'data>

Self, but with an arbitrary 'target lifetime instead of 'scope.
Source§

type WithData<'da> = <W as ManagedPriv<'scope, 'data>>::WithLifetimes<'scope, 'da>

Self, but with an arbitrary 'da lifetime instead of 'data.
Source§

fn as_ref(self) -> Ref<'scope, 'data, Self>

Convert self to a Ref.
Source§

fn as_value(self) -> Value<'scope, 'data>

Convert self to a Value.
Source§

fn root<'target, Tgt>( self, target: Tgt, ) -> Tgt::Data<'data, Self::InScope<'target>>
where Tgt: Target<'target>,

Use the target to reroot self.
Source§

fn unrooted_target(self) -> Unrooted<'scope>

Returns a new Unrooted.
Source§

fn display_string(self) -> JlrsResult<String>

Convert self to its display string, i.e. the string that is shown when calling Base.show.
Source§

fn error_string(self) -> JlrsResult<String>

Convert self to its error string, i.e. the string that is shown when calling Base.showerror. This string can contain ANSI color codes if this is enabled by calling Julia::error_color or AsyncHandle::error_color.
Source§

fn display_string_or<S: Into<String>>(self, default: S) -> String

Convert self to its display string, i.e. the string that is shown by calling Base.display, or some default value.
Source§

fn error_string_or<S: Into<String>>(self, default: S) -> String

Convert self to its error string, i.e. the string that is shown when this value is thrown as an exception, or some default value.
Source§

fn leak(self) -> Ref<'static, 'data, Self::InScope<'static>>

Extends the 'scope lifetime to 'static and converts it to a Ref, which allows this managed data to be leaked from a scope. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.