Struct Type

Source
pub struct Type {
    pub name: &'static str,
    pub methods: Option<Vec<Function>>,
    pub fields: Option<Vec<Function>>,
    pub type_id: TypeId,
}
Expand description

Structure representing main characteristics of an object type needed for the program, using the plugin, that either imports or defines this type in case this type is not present in the user program itself

A Type object contains

  • type name, used for identifying this type
  • its TypeId for Any trait to work properly

Fields§

§name: &'static str

Name for the TypeId owner to be reffered to as a static string

§methods: Option<Vec<Function>>

If an object of this type should have some functions, that can be called on it, they should be provided here. The functions provided here should be called using the same Freight::call_function function, so they should all have unique numbers

§fields: Option<Vec<Function>>

All fields of an object of this type, user needs to be able to access, should be located here. The field name then will be the function name, functions return type is the field type and the only argument of the function should be of the type, the field is owned by. These functions are once again called by the same Freight::call_function function and should all have unique numbers over all functions called by Freight::call_function

§type_id: TypeId

TypeId object, gotten from the structure, being provided to the program, that is using the plugin

See std::any::TypeId documentation to find out how to get a type id of a type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

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