Struct janetrs::function::JanetFunction[][src]

#[repr(transparent)]
pub struct JanetFunction<'data> { /* fields omitted */ }
Expand description

A representation of a Janet function defined at the Janet side.

Implementations

impl<'data> JanetFunction<'data>[src]

pub const unsafe fn from_raw(raw: *mut CJanetFunction) -> Self[src]

Create a new JanetFunction with a raw pointer.

Safety

This function do not check if the given raw is NULL or not. Use at your own risk.

pub fn call(
    &mut self,
    args: impl AsRef<[Janet]>
) -> Result<Janet, CallError<'data>>
[src]

Execute the JanetFunction with the given arguments.

This function may trigger a GC collection.

If the executions was successful returns the output, otherwise return the CallError with information returned by the call.

pub fn call_with_fiber<'fiber>(
    &mut self,
    fiber: JanetFiber<'fiber>,
    args: impl AsRef<[Janet]>
) -> Result<Janet, CallError<'fiber>>
[src]

Execute the JanetFunction with the given arguments wising the given fiber.

This function may trigger the a GC collection.

If the executions was successful returns the output, otherwise return the CallError with information returned by the call.

pub fn call_or_panic(&mut self, args: impl AsRef<[Janet]>) -> Janet[src]

Execute the JanetFunction with the given arguments.

This function can not trigger GC collection.

Janet Panics

Panics if anything goes wrong trying to call the function.

pub const fn as_raw(&self) -> *const CJanetFunction[src]

Return a raw pointer to the function raw structure.

The caller must ensure that the function outlives the pointer this function returns, or else it will end up pointing to garbage.

pub fn as_mut_raw(&mut self) -> *mut CJanetFunction[src]

Return a raw mutable pointer to the function raw structure.

The caller must ensure that the function outlives the pointer this function returns, or else it will end up pointing to garbage.

Trait Implementations

impl Debug for JanetFunction<'_>[src]

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

Formats the value using the given formatter. Read more

impl From<JanetFunction<'_>> for Janet[src]

fn from(val: JanetFunction<'_>) -> Self[src]

Performs the conversion.

impl<'data> Ord for JanetFunction<'data>[src]

fn cmp(&self, other: &JanetFunction<'data>) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<'data> PartialEq<JanetFunction<'data>> for JanetFunction<'data>[src]

fn eq(&self, other: &JanetFunction<'data>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &JanetFunction<'data>) -> bool[src]

This method tests for !=.

impl<'data> PartialOrd<JanetFunction<'data>> for JanetFunction<'data>[src]

fn partial_cmp(&self, other: &JanetFunction<'data>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl TryFrom<Janet> for JanetFunction<'_>[src]

type Error = JanetConversionError

The type returned in the event of a conversion error.

fn try_from(value: Janet) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl<'data> Eq for JanetFunction<'data>[src]

impl<'data> StructuralEq for JanetFunction<'data>[src]

impl<'data> StructuralPartialEq for JanetFunction<'data>[src]

Auto Trait Implementations

impl<'data> RefUnwindSafe for JanetFunction<'data>

impl<'data> !Send for JanetFunction<'data>

impl<'data> !Sync for JanetFunction<'data>

impl<'data> Unpin for JanetFunction<'data>

impl<'data> UnwindSafe for JanetFunction<'data>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.