pub struct Context {
pub type_info_directory: TypeInfoDirectory,
pub space_info_directory: SpaceInfoDirectory,
pub primitive_directory: PrimitiveDirectory,
}Expand description
Stores interpreter-global context information, such as the
collection of all types in the language, the collection of all
primitives, and the definitions of their associated featurization
maps. See TypeInfoDirectory, SpaceInfoDirectory, PrimitiveDirectory
for these individual components.
Fields§
§type_info_directory: TypeInfoDirectory§space_info_directory: SpaceInfoDirectory§primitive_directory: PrimitiveDirectoryImplementations§
Source§impl Context
impl Context
Sourcepub fn get_primitive(
&self,
primitive_term_pointer: PrimitiveTermPointer,
) -> &dyn FuncImpl
pub fn get_primitive( &self, primitive_term_pointer: PrimitiveTermPointer, ) -> &dyn FuncImpl
Given a PrimitiveTermPointer, yields the FuncImpl it references.
Sourcepub fn get_feature_space_info(&self, type_id: TypeId) -> &FeatureSpaceInfo
pub fn get_feature_space_info(&self, type_id: TypeId) -> &FeatureSpaceInfo
Gets a reference to the FeatureSpaceInfo for the given TypeId.
Sourcepub fn build_function_space_info(
&self,
arg_type_id: TypeId,
ret_type_id: TypeId,
) -> FunctionSpaceInfo<'_>
pub fn build_function_space_info( &self, arg_type_id: TypeId, ret_type_id: TypeId, ) -> FunctionSpaceInfo<'_>
Gets the FunctionSpaceInfo for functions going from the given arg_type_id to the
given ret_type_id.
Sourcepub fn get_function_space_info(
&self,
func_type_id: TypeId,
) -> FunctionSpaceInfo<'_>
pub fn get_function_space_info( &self, func_type_id: TypeId, ) -> FunctionSpaceInfo<'_>
Gets the FunctionSpaceInfo for the given function TypeId.
Sourcepub fn get_func_type_id(
&self,
arg_type_id: TypeId,
ret_type_id: TypeId,
) -> TypeId
pub fn get_func_type_id( &self, arg_type_id: TypeId, ret_type_id: TypeId, ) -> TypeId
Given the argument and result types for a function type, returns the
TypeId of the corresponding function type, assuming that it exists.
Sourcepub fn has_func_type(&self, arg_type_id: TypeId, ret_type_id: TypeId) -> bool
pub fn has_func_type(&self, arg_type_id: TypeId, ret_type_id: TypeId) -> bool
Given the argument and result types for a function type, returns true iff
the function type actually exists in the TypeInfoDirectory.
Sourcepub fn get_application_type_ids(&self, id: TypeId) -> Vec<(TypeId, TypeId)>
pub fn get_application_type_ids(&self, id: TypeId) -> Vec<(TypeId, TypeId)>
Given a target type, yields the collection of all pairs (func_type_id, arg_type_id)
in the TypeInfoDirectory for which the return type is the given target.
Sourcepub fn get_total_num_types(&self) -> usize
pub fn get_total_num_types(&self) -> usize
Returns the total number of types registered in the TypeInfoDirectory.
Sourcepub fn get_dimension(&self, vec_type_id: TypeId) -> usize
pub fn get_dimension(&self, vec_type_id: TypeId) -> usize
Given the TypeId of a vector type, yields the dimensionality of the
corresponding vector space.