I am trying to return an array of tuples in Rust, but I am running into issues with lifetimes:
pub trait Vertex{
fn map_components<'a>() -> &'a[(GLint, GLenum)];
}
pub struct VertexPos2d {
// Position
x: GLfloat,
y: GLfloat
}
impl Vertex for VertexPos2d{
fn map_components<'a>() -> &'a[(GLint, GLenum)]{
return &[
(2, gl::FLOAT) as (GLint, GLenum)
];
}
}
If I remove the tuple from the array everything seems to work fine. I've tried to adjust the lifetimes such that the tuples in the array have the same lifetime as the array itself but have not been able to get it to work. Are there some changes I can make to get this to work?