RustUtils

de.uni_luebeck.isp.tessla.tessla_compiler.backends.rustBackend.RustUtils$
object RustUtils

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def canBeHashed(t: TypeExpression): Boolean

Helper to determine whether a type can be hashed in Rust. The only types that cannot be hashed are Floats and Functions

Helper to determine whether a type can be hashed in Rust. The only types that cannot be hashed are Floats and Functions

Attributes

t

a type

Returns:

a bool describing if it is completely made up of hashable types

def convertType(t: TypeExpression, mask_generics: Boolean, wrap_type: Boolean): String

Converts TeSSLa type to corresponding rust types

Converts TeSSLa type to corresponding rust types

Attributes

mask_generics

Replace all generic types with _, resulting in them being inferred by rust. This is needed in anonymous functions, where you cannot specify generic types

t

Type to be converted. If type is Events[t] the result is equal to calling the function with t.

wrap_type

In some places we need the underlying type without wrapping it in TesslaValue<...>. For example in type parameters for structs: this way we can define structs such that their fields are guaranteed to be a TesslaValue with their content type as a type parameter.

Returns:

The converted type

def genericiseRecordType(record: RecordType): RecordType

Replaces the type of all fields of a RecordType with TypeParams.

Replaces the type of all fields of a RecordType with TypeParams.

Attributes

record

The RecordType to modify.

Returns:

The modified RecordType.

def getGenericTypeNames(types: Iterable[TypeExpression]): Set[Identifier]

Extracts all TypeParam types used in a list of types, and returns a set of their names.

Extracts all TypeParam types used in a list of types, and returns a set of their names.

Attributes

types

a list of types

Returns:

a set of all generic types used

def getStructName(fields: Map[String, (TypeExpression, Location)]): String

Create a struct name repeatably from the field names

Create a struct name repeatably from the field names

Attributes

fields

the field names and their types

Returns:

the name for that struct datatype

def isStructTuple(fieldNames: Seq[String]): Boolean

Figures out if a struct is a tuple. i.e. has field names _1,_2 ...

Figures out if a struct is a tuple. i.e. has field names _1,_2 ...

Attributes

fieldNames

The struct field names

Returns:

Whether given struct is tuple