logo
#[repr(C)]
pub struct som_passport_t { pub flags: u64, pub name: som_atom_t, pub properties: *const som_property_def_t, pub n_properties: usize, pub methods: *const som_method_def_t, pub n_methods: usize, pub item_getter: Option<extern "C" fn(thing: *mut som_asset_t, p_key: &VALUE, p_value: &mut VALUE) -> BOOL>, pub item_setter: Option<extern "C" fn(thing: *mut som_asset_t, p_key: &VALUE, p_value: &VALUE) -> BOOL>, pub item_next: Option<extern "C" fn(thing: *mut som_asset_t, p_idx: &mut VALUE, p_value: &mut VALUE) -> BOOL>, pub prop_getter: Option<extern "C" fn(thing: *mut som_asset_t, propSymbol: som_atom_t, p_value: &mut VALUE) -> BOOL>, pub prop_setter: Option<extern "C" fn(thing: *mut som_asset_t, propSymbol: som_atom_t, p_value: &VALUE) -> BOOL>, }
Expand description

Defines properties and methods of an asset.

Fields

flags: u64

Flags of an asset, see som_passport_flags.

name: som_atom_t

The name of the class (asset type).

properties: *const som_property_def_t

Properties: asset.prop.

Must be a pointer to an array of structures:

let mut pst = Box::new(som_passport_t::default());

type ObjectProps = [som_property_def_t; 2];
let mut props = Box::new(ObjectProps::default());

let mut prop1 = &mut props[0];
prop1.name = atom("age");

let mut prop2 = &mut props[1];
prop2.name = atom("name");

pst.n_properties = 2;
pst.properties = Box::into_raw(props) as *const _;
n_properties: usize

Properties count.

methods: *const som_method_def_t

Methods: asset.func()

Must be a pointer to an array of structures, see properties for an example.

n_methods: usize

Methods count.

item_getter: Option<extern "C" fn(thing: *mut som_asset_t, p_key: &VALUE, p_value: &mut VALUE) -> BOOL>

Index access: var item = asset[key].

item_setter: Option<extern "C" fn(thing: *mut som_asset_t, p_key: &VALUE, p_value: &VALUE) -> BOOL>

Index access: asset[key] = item.

item_next: Option<extern "C" fn(thing: *mut som_asset_t, p_idx: &mut VALUE, p_value: &mut VALUE) -> BOOL>

Enumeration: for(var item in asset).

prop_getter: Option<extern "C" fn(thing: *mut som_asset_t, propSymbol: som_atom_t, p_value: &mut VALUE) -> BOOL>

Property access interceptor: var val = asset.prop.

prop_setter: Option<extern "C" fn(thing: *mut som_asset_t, propSymbol: som_atom_t, p_value: &VALUE) -> BOOL>

Property set interceptor: asset.prop = val.

Trait Implementations

Empty passport.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.