Struct Prototype

Source
pub struct Prototype { /* private fields */ }
Expand description

A metadata about the available operations on the type.

The type’s operations are exposed using the export macro.

You can obtain this object from various API functions, including the TypeMeta::prototype function.

The Display implementation for this object returns a map of all available components (i.e., methods and fields) of the type.

Implementations§

Source§

impl Prototype

Source

pub fn implements_component(&self, name: &str) -> bool

Returns true if the underlying type has a component (a method or a field) with the specified name.

If this function returns true, the Object::component supports this component name.

The components are exposed using the #[export(component)] macro attribute.

Source

pub fn implements_field(&self) -> bool

Returns true if the underlying type has a dynamic field resolver.

If this function returns true, the Object::field operator is generally supported.

Dynamic field resolvers are exposed using the ScriptField trait.

Source

pub fn implements_assign(&self) -> bool

Returns true if the underlying type supports the assignment operator: lhs = rhs.

If this function returns true, the Object::assign operator is generally supported.

Assignment operators are exposed using the ScriptAssign trait.

Source

pub fn implements_concat(&self) -> bool

Returns true if the underlying type supports array constructors: [x, y, z].

If this function returns true, the TypeMeta::concat constructor is generally supported.

Concatenation operators are exposed using the ScriptConcat trait.

Source

pub fn implements_clone(&self) -> bool

Returns true if the underlying type supports cloning: *rhs.

If this function returns true, the Object::clone operator is generally supported.

Cloning operators are exposed using the ScriptClone trait.

Source

pub fn implements_debug(&self) -> bool

Returns true if the underlying type supports debug formatting.

If this function returns true, the Object::debug operator is generally supported.

Debug formatting operators are exposed using the ScriptDebug trait.

Source

pub fn implements_display(&self) -> bool

Returns true if the underlying type supports display formatting.

If this function returns true, the Object::display operator is generally supported.

Display formatting operators are exposed using the ScriptDisplay trait.

Source

pub fn implements_partial_eq(&self) -> bool

Returns true if the underlying type supports an equality operator: lhs == rhs.

If this function returns true, the Object::partial_eq operator is generally supported.

The assignment operators are exposed using the ScriptPartialEq trait.

Source

pub fn implements_default(&self) -> bool

Returns true if the underlying type supports default constructor.

If this function returns true, the TypeMeta::instantiate constructor is generally supported.

The default operators are exposed using the ScriptDefault trait.

Source

pub fn implements_partial_ord(&self) -> bool

Returns true if the underlying type supports a partial ordering operator: lhs >= rhs, lhs < rhs, etc.

If this function returns true, the Object::partial_ord operator is generally supported.

The partial ordering operators are exposed using the ScriptPartialOrd trait.

Source

pub fn implements_ord(&self) -> bool

Returns true if the underlying type supports a full ordering operator: lhs >= rhs, lhs < rhs, etc.

If this function returns true, the Object::ord operator is generally supported.

The full ordering operators are exposed using the ScriptOrd trait.

Source

pub fn implements_hash(&self) -> bool

Returns true if the underlying type supports data hashing.

If this function returns true, the Object::hash operator is generally supported.

The hashing operators are exposed using the ScriptHash trait.

Source

pub fn implements_invocation(&self) -> bool

Returns true if the underlying type supports an invocation operator: foo(a, b, c).

If this function returns true, the Object::invoke operator is generally supported.

The invocation operators are exposed using the ScriptInvocation trait.

Source

pub fn implements_binding(&self) -> bool

Returns true if the underlying type supports context binding.

If this function returns true, the Object::bind operator is generally supported.

The binging operators are exposed using the ScriptBinding trait.

Source

pub fn implements_add(&self) -> bool

Returns true if the underlying type supports an addition operator: lhs + rhs.

If this function returns true, the Object::add operator is generally supported.

The addition operators are exposed using the ScriptAdd trait.

Source

pub fn implements_add_assign(&self) -> bool

Returns true if the underlying type supports an addition and assignment operator: lhs += rhs.

If this function returns true, the Object::add_assign operator is generally supported.

The addition and assignment operators are exposed using the ScriptAddAssign trait.

Source

pub fn implements_sub(&self) -> bool

Returns true if the underlying type supports a subtraction operator: lhs - rhs.

If this function returns true, the Object::sub operator is generally supported.

The subtraction operators are exposed using the ScriptSub trait.

Source

pub fn implements_sub_assign(&self) -> bool

Returns true if the underlying type supports a subtraction and assignment operator: lhs -= rhs.

If this function returns true, the Object::sub_assign operator is generally supported.

The subtraction and assignment operators are exposed using the ScriptSubAssign trait.

Source

pub fn implements_mul(&self) -> bool

Returns true if the underlying type supports a multiplication operator: lhs * rhs.

If this function returns true, the Object::mul operator is generally supported.

The multiplication operators are exposed using the ScriptMul trait.

Source

pub fn implements_mul_assign(&self) -> bool

Returns true if the underlying type supports a multiplication and assignment operator: lhs *= rhs.

If this function returns true, the Object::sub_assign operator is generally supported.

The multiplication and assignment operators are exposed using the ScriptMulAssign trait.

Source

pub fn implements_div(&self) -> bool

Returns true if the underlying type supports a division operator: lhs / rhs.

If this function returns true, the Object::div operator is generally supported.

The division operators are exposed using the ScriptDiv trait.

Source

pub fn implements_div_assign(&self) -> bool

Returns true if the underlying type supports a division and assignment operator: lhs /= rhs.

If this function returns true, the Object::div_assign operator is generally supported.

The division and assignment operators are exposed using the ScriptDivAssign trait.

Source

pub fn implements_and(&self) -> bool

Returns true if the underlying type supports a logical conjunction operator: lhs && rhs.

If this function returns true, the Object::and operator is generally supported.

The logical conjunction operators are exposed using the ScriptAnd trait.

Source

pub fn implements_or(&self) -> bool

Returns true if the underlying type supports a logical disjunction operator: lhs || rhs.

If this function returns true, the Object::or operator is generally supported.

The logical disjunction operators are exposed using the ScriptOr trait.

Source

pub fn implements_not(&self) -> bool

Returns true if the underlying type supports a logical negation operator: !foo.

If this function returns true, the Object::not operator is generally supported.

The logical negation operators are exposed using the ScriptNot trait.

Source

pub fn implements_neg(&self) -> bool

Returns true if the underlying type supports a numeric negation operator: -foo.

If this function returns true, the Object::neg operator is generally supported.

The numeric negation operators are exposed using the ScriptNeg trait.

Source

pub fn implements_bit_and(&self) -> bool

Returns true if the underlying type supports a bitwise conjunction operator: lhs & rhs.

If this function returns true, the Object::bit_and operator is generally supported.

The bitwise conjunction operators are exposed using the ScriptBitAnd trait.

Source

pub fn implements_bit_and_assign(&self) -> bool

Returns true if the underlying type supports a bitwise conjunction and assignment operator: lhs &= rhs.

If this function returns true, the Object::bit_and_assign operator is generally supported.

The bitwise conjunction and assignment operators are exposed using the ScriptBitAndAssign trait.

Source

pub fn implements_bit_or(&self) -> bool

Returns true if the underlying type supports a bitwise disjunction operator: lhs | rhs.

If this function returns true, the Object::bit_or operator is generally supported.

The bitwise disjunction operators are exposed using the ScriptBitOr trait.

Source

pub fn implements_bit_or_assign(&self) -> bool

Returns true if the underlying type supports a bitwise disjunction and assignment operator: lhs |= rhs.

If this function returns true, the Object::bit_or_assign operator is generally supported.

The bitwise disjunction and assignment operators are exposed using the ScriptBitOrAssign trait.

Source

pub fn implements_bit_xor(&self) -> bool

Returns true if the underlying type supports a bitwise exclusive disjunction operator: lhs ^ rhs.

If this function returns true, the Object::bit_xor operator is generally supported.

The bitwise exclusive disjunction operators are exposed using the ScriptBitXor trait.

Source

pub fn implements_bit_xor_assign(&self) -> bool

Returns true if the underlying type supports a bitwise exclusive disjunction and assignment operator: lhs ^= rhs.

If this function returns true, the Object::bit_xor_assign operator is generally supported.

The bitwise exclusive disjunction and assignment operators are exposed using the ScriptBitXorAssign trait.

Source

pub fn implements_shl(&self) -> bool

Returns true if the underlying type supports a bitwise left shift operator: lhs << rhs.

If this function returns true, the Object::shl operator is generally supported.

The bitwise left shift operators are exposed using the ScriptShl trait.

Source

pub fn implements_shl_assign(&self) -> bool

Returns true if the underlying type supports a bitwise left shift and assignment operator: lhs <<= rhs.

If this function returns true, the Object::shl_assign operator is generally supported.

The bitwise left shift and assignment operators are exposed using the ScriptShlAssign trait.

Source

pub fn implements_shr(&self) -> bool

Returns true if the underlying type supports a bitwise right shift operator: lhs >> rhs.

If this function returns true, the Object::shr operator is generally supported.

The bitwise right shift operators are exposed using the ScriptShr trait.

Source

pub fn implements_shr_assign(&self) -> bool

Returns true if the underlying type supports a bitwise right shift and assignment operator: lhs >>= rhs.

If this function returns true, the Object::shr_assign operator is generally supported.

The bitwise right shift and assignment operators are exposed using the ScriptShrAssign trait.

Source

pub fn implements_rem(&self) -> bool

Returns true if the underlying type supports a reminder of division operator: lhs % rhs.

If this function returns true, the Object::rem operator is generally supported.

The reminder of division operators are exposed using the ScriptRem trait.

Source

pub fn implements_rem_assign(&self) -> bool

Returns true if the underlying type supports a reminder of division and assignment operator: lhs %= rhs.

If this function returns true, the Object::rem_assign operator is generally supported.

The reminder of division and assignment operators are exposed using the ScriptRemAssign trait.

Source

pub fn implements_none(&self) -> bool

Returns true if this type represents void data. The query script operator foo? tests if the underlying object has “none”-type.

In particular the Nil is a “none”-type.

The none markers are exposed using the ScriptNone trait.

Source

pub fn hint_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the assignment operator: lhs = rhs.

The returned type metadata corresponds to the ScriptAssign::RHS associated type.

If the assignment operator is not supported, the function returns None.

Source

pub fn hint_concat_result(&self) -> Option<&'static TypeMeta>

Returns the type of the result of objects concatenations: [a, b, c].

The returned type metadata corresponds to the ScriptConcat::Result associated type.

If the concatenation operator is not supported, the function returns None.

Source

pub fn hint_component(&self, name: impl AsRef<str>) -> Option<ComponentHint>

Returns the description of the type’s component (e.g., a Rust struct method or field).

The name parameter specifies the component’s name (e.g., foo.<name>).

If this type does not have the specified component, the function returns None.

Source

pub fn hint_all_components(&self) -> impl Iterator<Item = ComponentHint> + '_

Enumerates all exported components of this type (e.g., all Rust struct methods and fields). The iterator yields descriptions for each component.

Source

pub fn components_len(&self) -> usize

Returns the number of all known exported components of this type (e.g., the number of all Rust struct methods and fields).

Source

pub fn hint_field(&self) -> Option<&'static TypeMeta>

Returns the type of the result of objects concatenations: [a, b, c].

The returned type metadata corresponds to the ScriptConcat::Result associated type.

If the concatenation operator is not supported, the function returns None.

Source

pub fn hint_partial_eq_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the quality operator: lhs == rhs.

The returned type metadata corresponds to the ScriptPartialEq::RHS associated type.

If the equality operator is not supported, the function returns None.

Source

pub fn hint_partial_ord_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the partial ordering operator: lhs >= rhs, lhs < rhs, etc.

The returned type metadata corresponds to the ScriptPartialOrd::RHS associated type.

If the partial ordering operator is not supported, the function returns None.

Source

pub fn hint_invocation(&self) -> Option<&'static InvocationMeta>

Returns the invocation operator description for the type: foo(a, b, c).

If the invocation operator is not supported, the function returns None.

Source

pub fn hint_add_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the addition operator: lhs + rhs.

The returned type metadata corresponds to the ScriptAdd::RHS associated type.

If the addition operator is not supported, the function returns None.

Source

pub fn hint_add_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the addition operator: lhs + rhs.

The returned type metadata corresponds to the ScriptAdd::Result associated type.

If the addition operator is not supported, the function returns None.

Source

pub fn hint_add_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the addition and assignment operator: lhs += rhs.

The returned type metadata corresponds to the ScriptAddAssign::RHS associated type.

If the addition and assignment operator is not supported, the function returns None.

Source

pub fn hint_sub_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the subtraction operator: lhs - rhs.

The returned type metadata corresponds to the ScriptSub::RHS associated type.

If the subtraction operator is not supported, the function returns None.

Source

pub fn hint_sub_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the subtraction operator: lhs - rhs.

The returned type metadata corresponds to the ScriptSub::Result associated type.

If the subtraction operator is not supported, the function returns None.

Source

pub fn hint_sub_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the subtraction and assignment operator: lhs -= rhs.

The returned type metadata corresponds to the ScriptSubAssign::RHS associated type.

If the subtraction and assignment operator is not supported, the function returns None.

Source

pub fn hint_mul_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the multiplication operator: lhs * rhs.

The returned type metadata corresponds to the ScriptMul::RHS associated type.

If the multiplication operator is not supported, the function returns None.

Source

pub fn hint_mul_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the multiplication operator: lhs * rhs.

The returned type metadata corresponds to the ScriptMul::Result associated type.

If the multiplication operator is not supported, the function returns None.

Source

pub fn hint_mul_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the multiplication and assignment operator: lhs *= rhs.

The returned type metadata corresponds to the ScriptMulAssign::RHS associated type.

If the multiplication and assignment operator is not supported, the function returns None.

Source

pub fn hint_div_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the division operator: lhs / rhs.

The returned type metadata corresponds to the ScriptDiv::RHS associated type.

If the division operator is not supported, the function returns None.

Source

pub fn hint_div_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the division operator: lhs / rhs.

The returned type metadata corresponds to the ScriptDiv::Result associated type.

If the division operator is not supported, the function returns None.

Source

pub fn hint_div_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the division and assignment operator: lhs /= rhs.

The returned type metadata corresponds to the ScriptDivAssign::RHS associated type.

If the division and assignment operator is not supported, the function returns None.

Source

pub fn hint_and_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the logical conjunction operator: lhs && rhs.

The returned type metadata corresponds to the ScriptAnd::RHS associated type.

If the logical conjunction operator is not supported, the function returns None.

Source

pub fn hint_and_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the logical conjunction operator: lhs && rhs.

The returned type metadata corresponds to the ScriptAnd::Result associated type.

If the logical conjunction operator is not supported, the function returns None.

Source

pub fn hint_or_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the logical disjunction operator: lhs || rhs.

The returned type metadata corresponds to the ScriptOr::RHS associated type.

If the logical disjunction operator is not supported, the function returns None.

Source

pub fn hint_or_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the logical disjunction operator: lhs || rhs.

The returned type metadata corresponds to the ScriptOr::Result associated type.

If the logical disjunction operator is not supported, the function returns None.

Source

pub fn hint_not_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the logical negation operator: !foo.

The returned type metadata corresponds to the ScriptNot::Result associated type.

If the logical negation operator is not supported, the function returns None.

Source

pub fn hint_neg_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the numeric negation operator: -foo.

The returned type metadata corresponds to the ScriptNeg::Result associated type.

If the numeric negation operator is not supported, the function returns None.

Source

pub fn hint_bit_and_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise conjunction operator: lhs & rhs.

The returned type metadata corresponds to the ScriptBitAnd::RHS associated type.

If the bitwise conjunction operator is not supported, the function returns None.

Source

pub fn hint_bit_and_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the bitwise conjunction operator: lhs & rhs.

The returned type metadata corresponds to the ScriptBitAnd::Result associated type.

If the bitwise conjunction operator is not supported, the function returns None.

Source

pub fn hint_bit_and_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise conjunction and assignment operator: lhs &= rhs.

The returned type metadata corresponds to the ScriptBitAndAssign::RHS associated type.

If the bitwise conjunction and assignment operator is not supported, the function returns None.

Source

pub fn hint_bit_or_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise disjunction operator: lhs | rhs.

The returned type metadata corresponds to the ScriptBitOr::RHS associated type.

If the bitwise disjunction operator is not supported, the function returns None.

Source

pub fn hint_bit_or_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the bitwise disjunction operator: lhs | rhs.

The returned type metadata corresponds to the ScriptBitOr::Result associated type.

If the bitwise disjunction operator is not supported, the function returns None.

Source

pub fn hint_bit_or_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise disjunction and assignment operator: lhs |= rhs.

The returned type metadata corresponds to the ScriptBitOrAssign::RHS associated type.

If the bitwise disjunction and assignment operator is not supported, the function returns None.

Source

pub fn hint_bit_xor_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise exclusive disjunction operator: lhs ^ rhs.

The returned type metadata corresponds to the ScriptBitXor::RHS associated type.

If the bitwise exclusive disjunction operator is not supported, the function returns None.

Source

pub fn hint_bit_xor_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the bitwise exclusive disjunction operator: lhs ^ rhs.

The returned type metadata corresponds to the ScriptBitXor::Result associated type.

If the bitwise exclusive disjunction operator is not supported, the function returns None.

Source

pub fn hint_bit_xor_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise exclusive disjunction and assignment operator: lhs ^= rhs.

The returned type metadata corresponds to the ScriptBitXorAssign::RHS associated type.

If the bitwise exclusive disjunction and assignment operator is not supported, the function returns None.

Source

pub fn hint_shl_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise left shift operator: lhs << rhs.

The returned type metadata corresponds to the ScriptShl::RHS associated type.

If the bitwise left shift operator is not supported, the function returns None.

Source

pub fn hint_shl_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the bitwise left shift operator: lhs << rhs.

The returned type metadata corresponds to the ScriptShl::Result associated type.

If the bitwise left shift operator is not supported, the function returns None.

Source

pub fn hint_shl_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the left shift and assignment operator: lhs <<= rhs.

The returned type metadata corresponds to the ScriptShlAssign::RHS associated type.

If the left shift and assignment operator is not supported, the function returns None.

Source

pub fn hint_shr_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the bitwise right shift operator: lhs >> rhs.

The returned type metadata corresponds to the ScriptShr::RHS associated type.

If the bitwise right shift operator is not supported, the function returns None.

Source

pub fn hint_shr_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the bitwise right shift operator: lhs >> rhs.

The returned type metadata corresponds to the ScriptShr::Result associated type.

If the bitwise right shift operator is not supported, the function returns None.

Source

pub fn hint_shr_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the right shift and assignment operator: lhs >>= rhs.

The returned type metadata corresponds to the ScriptShrAssign::RHS associated type.

If the right shift and assignment operator is not supported, the function returns None.

Source

pub fn hint_rem_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the reminder of division operator: lhs % rhs.

The returned type metadata corresponds to the ScriptRem::RHS associated type.

If the reminder of division operator is not supported, the function returns None.

Source

pub fn hint_rem_result(&self) -> Option<&'static TypeMeta>

Returns the result type of the reminder of division operator: lhs % rhs.

The returned type metadata corresponds to the ScriptRem::Result associated type.

If the reminder of division operator is not supported, the function returns None.

Source

pub fn hint_rem_assign_rhs(&self) -> Option<&'static TypeMeta>

Returns the right-hand side type of the reminder of division and assignment operator: lhs %= rhs.

The returned type metadata corresponds to the ScriptRemAssign::RHS associated type.

If the reminder of division and assignment operator is not supported, the function returns None.

Trait Implementations§

Source§

impl Debug for Prototype

Source§

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

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

impl Default for Prototype

Source§

fn default() -> Prototype

Returns the “default value” for a type. Read more
Source§

impl Display for Prototype

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> ToCompactString for T
where T: Display,

Source§

fn to_compact_string(&self) -> CompactString

Converts the given value to a CompactString. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

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

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.