Struct janetrs::Janet

source ·
pub struct Janet { /* private fields */ }
Expand description

Janet is the central structure of the Janet Language.

All possible Janet types are represented at some point as this structure, either to receive as arguments ou return something to Janet VM.

§Creating new values

With exception to Janet nil value the best way to create a Janet value is to use the Janet::wrap function, it can receive anything that can be turned Into Janet. For the nil value, there is a nice function for that, the Janet::nil function.

It is also possible to use the From trait to convert as well.

§Examples

use janetrs::Janet;

let j_nil = Janet::nil();
let jnt = Janet::wrap(10); // A Number Janet
let jnt_str = Janet::wrap("Hello"); // A JanetString Janet
let from_jnt = Janet::from(true); // A boolean Janet

§Extracting/Unwrapping Janet values

To extract/unwrap the Janet value you can use the Janet::unwrap method, that will return a TaggedJanet that you can pattern match to use the extracted value.

§Example

use janetrs::{Janet, TaggedJanet};

let jnt = Janet::wrap(10); // A Number Janet

match jnt.unwrap() {
    TaggedJanet::Abstract(jabstract) => {},
    TaggedJanet::Array(array) => {},
    TaggedJanet::Boolean(boolean) => {},
    TaggedJanet::Buffer(buffer) => {},
    TaggedJanet::CFunction(c_fun) => {},
    TaggedJanet::Fiber(fiber) => {},
    TaggedJanet::Function(func) => {},
    TaggedJanet::Keyword(keyword) => {},
    TaggedJanet::Nil => {},
    TaggedJanet::Number(num) => {},
    TaggedJanet::Pointer(ptr) => {},
    TaggedJanet::String(string) => {},
    TaggedJanet::Struct(st) => {},
    TaggedJanet::Symbol(symbol) => {},
    TaggedJanet::Table(table) => {},
    TaggedJanet::Tuple(tuple) => {},
};

To extract/unwrap the Janet value you can use the Janet::try_unwrap method, that will return a Result either with the resulted type of and conversion error.

It is possible to use the TryFrom trait, but that requires to include the trait in the context.

§Example

use janetrs::{Janet, JanetString};

let jnt = Janet::wrap(10); // A Number Janet

let res_num: Result<f64, _> = jnt.try_unwrap();
assert!(res_num.is_ok());

let res_string = jnt.try_unwrap::<JanetString>();
assert!(res_string.is_err());

Implementations§

source§

impl Janet

source

pub fn nil() -> Self

Create a nil Janet.

source

pub fn boolean(value: bool) -> Self

Create a boolean Janet with value.

source

pub fn number(value: f64) -> Self

Create a number Janet with value.

source

pub fn integer(value: i32) -> Self

Create a number Janet with a i32 value.

source

pub fn int64(value: i64) -> Self

Create a abstract integer Janet with value.

source

pub fn uint64(value: u64) -> Self

Create a abstract integer Janet with value.

source

pub fn array(value: JanetArray<'_>) -> Self

Create a array Janet with value.

source

pub fn buffer(value: JanetBuffer<'_>) -> Self

Create a buffer Janet with value.

source

pub fn table(value: JanetTable<'_>) -> Self

Create a table Janet with value.

source

pub fn tuple(value: JanetTuple<'_>) -> Self

Create a tuple Janet with value.

source

pub fn string(value: JanetString<'_>) -> Self

Create a string Janet with value.

source

pub fn structs(value: JanetStruct<'_>) -> Self

Create a struct Janet with value.

source

pub fn symbol(value: JanetSymbol<'_>) -> Self

Create a symbol Janet with value.

source

pub fn keyword(value: JanetKeyword<'_>) -> Self

Create a keyword Janet with value.

source

pub fn fiber(value: JanetFiber<'_>) -> Self

Create a fiber Janet with value.

source

pub fn function(value: JanetFunction<'_>) -> Self

Create a function Janet with value.

source

pub fn c_function(value: JanetCFunction) -> Self

Create a C function Janet with value.

source

pub fn pointer(value: JanetPointer) -> Self

Create a pointer Janet with value.

source

pub fn j_abstract(value: JanetAbstract) -> Self

Create as abstract Janet with value.

source

pub fn dynamic(key: impl AsRef<[u8]>) -> Option<Self>

Get a dynamic keyword binding from the environment if it exists.

source

pub fn from_core<'a>(symbol: impl Into<JanetSymbol<'a>>) -> Option<Self>

Resolve a symbol in the core environment.

source

pub fn wrap(value: impl Into<Self>) -> Self

Wraps a value into a Janet.

source

pub fn unwrap<'data>(self) -> TaggedJanet<'data>

Unwrap the Janet value into a enum that holds the type value

source

pub fn unwrap_or<T: TryFrom<Self>>(self, default: T) -> T

Returns the contained value or a provided default

Consumes the self argument then, if the conversion to type T goes correctly, returns the contained value, otherwise if the conversion fails, returns the given default value for that type.

Arguments passed to unwrap_or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use unwrap_or_else, which is lazily evaluated.

§Example
use janetrs::Janet;

let default = 2.0;
let x = Janet::number(9.0);
assert_eq!(x.unwrap_or(default), 9.0);

let x = Janet::boolean(true);
assert_eq!(x.unwrap_or(default), default);
source

pub fn unwrap_or_else<T, F>(self, op: F) -> T
where T: TryFrom<Self>, F: FnOnce(T::Error) -> T,

Returns the contained value or computes it from a closure.

The closure holds the value of the conversion error to better handle it to decide a default value to return.

§Example
use janetrs::Janet;

let default = |_| 1.0;
let x = Janet::number(9.0);
assert_eq!(x.unwrap_or_else(default), 9.0);

let x = Janet::boolean(true);
assert_eq!(x.unwrap_or_else(default), 1.0);
source

pub fn unwrap_or_default<T>(self) -> T
where T: TryFrom<Self> + Default,

Returns the contained value or a default

Consumes the self argument then, if the conversion to type T goes correctly, returns the contained value, otherwise if the conversion fails, returns the default value for that type.

§Examples
use janetrs::Janet;

let x = Janet::number(9.0);
assert_eq!(x.unwrap_or_default::<f64>(), 9.0);

let x = Janet::boolean(true);
assert_eq!(x.unwrap_or_default::<f64>(), 0.0);
source

pub fn try_unwrap<T: TryFrom<Self>>(self) -> Result<T, T::Error>

Tries to unwrap the Janet into a concrete type that implements TryFrom<Janet>.

source

pub fn is_nil(&self) -> bool

Return true if Janet is nil type.

source

pub fn len(&self) -> Option<i32>

Returns the length of a Janet if it is of a applicable type (Abstract, Array, Buffer, Keyword, Struct, Symbol, Table, Tuple).

Janet Panics: If the Janet value is a Janet Abstract and the method to get the length (janet) panics, this function janet panics as well.

source

pub fn is_empty(&self) -> bool

Returns true if Janet has a applicable type (Abstract, Array, Buffer, Keyword, Struct, Symbol, Table, Tuple) and the length of it is zero, and false otherwise.

Janet Panic: This function may panic for the same reason as Janet::len

source

pub fn is_truthy(&self) -> bool

Returns true if the Janet value are truthy.

source

pub fn get_method(&self, method_name: &str) -> Option<Self>

Returns a Janet value containing the requested method if it exists.

source

pub fn has_method(&self, method_name: &str) -> bool

Returns true if the Janet has a method called method_name

source

pub fn kind(&self) -> JanetType

Returns the type of Janet object.

source

pub const fn raw_data(&self) -> CJanet

Returns the raw data of the data

Trait Implementations§

source§

impl Clone for Janet

source§

fn clone(&self) -> Janet

Returns a copy 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 Debug for Janet

source§

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

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

impl DeepEq for Janet

source§

fn deep_eq(&self, other: &Self) -> bool

source§

impl Display for Janet

source§

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

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

impl Error for Janet

Available on crate feature std only.
1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl<'a> Extend<&'a Janet> for JanetArray<'_>

source§

fn extend<T: IntoIterator<Item = &'a Janet>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<Janet> for JanetArray<'_>

source§

fn extend<T: IntoIterator<Item = Janet>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl From<&Janet> for Janet

source§

fn from(val: &Janet) -> Self

Converts to this type from the input type.
source§

impl From<&Janet> for Janet

source§

fn from(val: &Self) -> Self

Converts to this type from the input type.
source§

impl From<&Janet> for Janet

source§

fn from(val: &CJanet) -> Self

Converts to this type from the input type.
source§

impl From<&JanetArray<'_>> for Janet

source§

fn from(val: &JanetArray<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetBuffer<'_>> for Janet

source§

fn from(val: &JanetBuffer<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetFiber<'_>> for Janet

source§

fn from(val: &JanetFiber<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetFunction<'_>> for Janet

source§

fn from(val: &JanetFunction<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetKeyword<'_>> for Janet

source§

fn from(val: &JanetKeyword<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetPointer> for Janet

source§

fn from(val: &JanetPointer) -> Self

Converts to this type from the input type.
source§

impl From<&JanetString<'_>> for Janet

source§

fn from(val: &JanetString<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetStruct<'_>> for Janet

source§

fn from(val: &JanetStruct<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetSymbol<'_>> for Janet

source§

fn from(val: &JanetSymbol<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetTable<'_>> for Janet

source§

fn from(val: &JanetTable<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&JanetTuple<'_>> for Janet

source§

fn from(val: &JanetTuple<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&bool> for Janet

source§

fn from(val: &bool) -> Self

Converts to this type from the input type.
source§

impl From<&char> for Janet

source§

fn from(val: &char) -> Self

Converts to this type from the input type.
source§

impl From<&f64> for Janet

source§

fn from(val: &f64) -> Self

Converts to this type from the input type.
source§

impl From<&i32> for Janet

source§

fn from(val: &i32) -> Self

Converts to this type from the input type.
source§

impl From<&i64> for Janet

source§

fn from(val: &i64) -> Self

Converts to this type from the input type.
source§

impl From<&mut JanetArray<'_>> for Janet

source§

fn from(val: &mut JanetArray<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&mut JanetBuffer<'_>> for Janet

source§

fn from(val: &mut JanetBuffer<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&mut JanetTable<'_>> for Janet

source§

fn from(val: &mut JanetTable<'_>) -> Self

Converts to this type from the input type.
source§

impl From<&str> for Janet

source§

fn from(val: &str) -> Self

Converts to this type from the input type.
source§

impl From<&u64> for Janet

source§

fn from(val: &u64) -> Self

Converts to this type from the input type.
source§

impl From<Janet> for Janet

source§

fn from(val: CJanet) -> Self

Converts to this type from the input type.
source§

impl From<Janet> for Janet

source§

fn from(val: Janet) -> Self

Converts to this type from the input type.
source§

impl From<Janet> for TaggedJanet<'_>

source§

fn from(val: Janet) -> Self

Converts to this type from the input type.
source§

impl From<JanetAbstract> for Janet

source§

fn from(val: JanetAbstract) -> Self

Converts to this type from the input type.
source§

impl From<JanetArray<'_>> for Janet

source§

fn from(val: JanetArray<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetBuffer<'_>> for Janet

source§

fn from(val: JanetBuffer<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetFiber<'_>> for Janet

source§

fn from(val: JanetFiber<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetFile> for Janet

source§

fn from(value: JanetFile) -> Self

Converts to this type from the input type.
source§

impl From<JanetFunction<'_>> for Janet

source§

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

Converts to this type from the input type.
source§

impl From<JanetKeyword<'_>> for Janet

source§

fn from(val: JanetKeyword<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetPointer> for Janet

source§

fn from(val: JanetPointer) -> Self

Converts to this type from the input type.
source§

impl From<JanetRng> for Janet

source§

fn from(value: JanetRng) -> Self

Converts to this type from the input type.
source§

impl From<JanetString<'_>> for Janet

source§

fn from(val: JanetString<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetStruct<'_>> for Janet

source§

fn from(val: JanetStruct<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetSymbol<'_>> for Janet

source§

fn from(val: JanetSymbol<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetTable<'_>> for Janet

source§

fn from(val: JanetTable<'_>) -> Self

Converts to this type from the input type.
source§

impl From<JanetTuple<'_>> for Janet

source§

fn from(val: JanetTuple<'_>) -> Self

Converts to this type from the input type.
source§

impl From<Option<unsafe extern "C-unwind" fn(_: i32, _: *mut Janet) -> Janet>> for Janet

source§

fn from(val: JanetCFunction) -> Self

Converts to this type from the input type.
source§

impl From<TaggedJanet<'_>> for Janet

source§

fn from(val: TaggedJanet<'_>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Janet

source§

fn from(val: bool) -> Self

Converts to this type from the input type.
source§

impl From<char> for Janet

source§

fn from(val: char) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Janet

source§

fn from(val: f64) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Janet

source§

fn from(val: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Janet

source§

fn from(val: i64) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Janet

source§

fn from(val: u64) -> Self

Converts to this type from the input type.
source§

impl Hash for Janet

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Janet

source§

fn cmp(&self, other: &Janet) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<&Janet> for Janet

source§

fn eq(&self, other: &&Janet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&Janet> for Janet

source§

fn eq(&self, other: &&CJanet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<&Janet> for Janet

source§

fn eq(&self, other: &&Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Janet> for &Janet

source§

fn eq(&self, other: &Janet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Janet> for Janet

source§

fn eq(&self, other: &CJanet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Janet> for Janet

source§

fn eq(&self, other: &Janet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Janet

source§

fn eq(&self, other: &Janet) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<&Janet> for Janet

source§

fn partial_cmp(&self, other: &&Self) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd<&Janet> for Janet

source§

fn partial_cmp(&self, other: &&CJanet) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd<&Janet> for Janet

source§

fn partial_cmp(&self, other: &&Janet) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd<Janet> for &Janet

source§

fn partial_cmp(&self, other: &Janet) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd<Janet> for Janet

source§

fn partial_cmp(&self, other: &Janet) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd<Janet> for Janet

source§

fn partial_cmp(&self, other: &CJanet) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd for Janet

source§

fn partial_cmp(&self, other: &Janet) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl TryFrom<Janet> for JanetAbstract

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetArray<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetBuffer<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetFiber<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetFunction<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetKeyword<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetPointer

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetString<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetStruct<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetSymbol<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetTable<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetTuple<'_>

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for JanetCFunction

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for bool

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for f64

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for i32

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for i64

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl TryFrom<Janet> for u64

§

type Error = JanetConversionError

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

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

Performs the conversion.
source§

impl Copy for Janet

source§

impl Eq for Janet

source§

impl StructuralPartialEq for Janet

Auto Trait Implementations§

§

impl Freeze for Janet

§

impl RefUnwindSafe for Janet

§

impl !Send for Janet

§

impl !Sync for Janet

§

impl Unpin for Janet

§

impl UnwindSafe for Janet

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> 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<T> ToOwned for T
where T: Clone,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.