TomBebbington / jit.rs

LibJIT wrapper for Rust
http://tombebbington.github.io/jit.rs/jit/index.html
MIT License
59 stars 11 forks source link

Seperate `Type` into `Type` and `Ty` for owned and unowned types #4

Closed TomBebbington closed 9 years ago

TomBebbington commented 9 years ago

This should be analogous to String and str - Ty should be used behind a pointer and be used to save some clones that would usually be done on the owned types.

pub struct Ty {
    _type: jit_type_t
}
impl !Sized for Ty {}
impl Ty {
    fn get_i8() -> &'static Ty {
        ....
    }
}
impl ToOwned for Ty {
    fn to_owned(&self) -> Type {
        ...
    }
}

pub struct Type {
    _type: jit_type_t
}
impl Deref for Type {
    type Target = Ty;
    fn deref(&self) -> &Ty {
        ...
    }
}
TomBebbington commented 9 years ago

Implemented as of a few days ago!