Struct jit::TaggedType [] [src]

pub struct TaggedType<T> {
    // some fields omitted


impl<T> TaggedType<T>

fn new(ty: &Ty, kind: TypeKind, data: Box<T>) -> TaggedType<T>

Create a new tagged type

fn get_tagged_data(&self) -> Option<&T>

Get the data this is tagged to

fn get_tagged_type(&self) -> &Ty

Get the type this is tagged to

fn set_tagged_data(&self, data: Box<T>)

Change the data this is tagged to

Methods from Deref<Target=Ty>

fn get_size(&self) -> usize

Get the size of this type in bytes.

fn get_alignment(&self) -> usize

Get the alignment of this type in bytes.

fn get_kind(&self) -> TypeKind

Get a value that indicates the kind of this type. This allows callers to quickly classify a type to determine how it should be handled further.

fn get_ref(&self) -> Option<&Ty>

Get the type that is referred to by this pointer type.

fn get_return(&self) -> Option<&Ty>

Get the type returned by this function type.

fn set_names(&mut self, names: &[&str])

Set the field or parameter names of this struct or union type.

use jit::*;
let f64_t = get::<f64>();
let mut ty = Type::new_struct(&mut [&f64_t, &f64_t]);
ty.set_names(&["x", "y"]);
assert_eq!(ty.get_field("x").unwrap().get_type(), &f64_t as &Ty);
assert_eq!(ty.get_field("y").unwrap().get_type(), &f64_t as &Ty);

fn fields(&self) -> Fields

Iterate over the type's fields

use jit::*;
let pos_t = get::<(f64, f64)>();
let f64_t = get::<f64>();
for field in pos_t.fields() {
    assert_eq!(field.get_type(), &f64_t as &Ty);

fn params(&self) -> Params

Iterate over the function signature's parameters

use jit::*;
let sig_t = get::<fn(i32, i32) -> i32>();
let i32_t = get::<i32>();
for param in sig_t.params() {
    assert_eq!(param, &i32_t as &Ty);

fn get_field(&self, name: &str) -> Option<Field>

Find the field/parameter index for a particular name.

fn is_primitive(&self) -> bool

Check if this is a primitive

use jit::*;
assert!(!get::<(i16, i16)>().is_primitive());

fn is_float(&self) -> bool

Check if this is a floating-point number

use jit::*;

fn is_int(&self) -> bool

Check if this is an integer

use jit::*;

fn is_struct(&self) -> bool

Check if this is a struct

use jit::*;
assert!(get::<(i16, i16)>().is_struct());

fn is_union(&self) -> bool

Check if this is a union

fn is_signature(&self) -> bool

Check if this is a signature

use jit::*;
assert!(get::<fn(i16) -> i16>().is_signature());

fn is_pointer(&self) -> bool

Check if this is a pointer

use jit::*;
assert!(get::<&'static u8>().is_pointer());

fn is_tagged(&self) -> bool

Check if this is tagged

Trait Implementations

impl<'a, T> Into<jit_type_t> for &'a TaggedType<T>

fn into(self) -> jit_type_t

impl<T> From<jit_type_t> for TaggedType<T>

fn from(ptr: jit_type_t) -> TaggedType<T>

impl<T> Drop for TaggedType<T>

fn drop(&mut self)

impl<T> Deref for TaggedType<T>

type Target = Ty

fn deref(&self) -> &Ty

Derived Implementations

impl<T: Eq> Eq for TaggedType<T> where T: Eq

impl<T: PartialEq> PartialEq for TaggedType<T> where T: PartialEq

fn eq(&self, __arg_0: &TaggedType<T>) -> bool

fn ne(&self, __arg_0: &TaggedType<T>) -> bool