Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.49 KB | None | 0 0
  1. struct TextureTable<'a> {
  2.    table: [[Option<Texture<'a>>; 6]; 2],
  3. }
  4.  
  5. impl<'a> TextureTable<'a> {
  6.     fn new(creator: &'a TextureCreator<WindowContext>) -> Result<TextureTable<'a>, String> {
  7.         let mut table = TextureTable { table: [[Option::None; 6]; 2] };
  8.         table.table[0][3] = Option::Some(creator.load_texture("/path/to/image")?);
  9.         Result::Ok(table)
  10.     }
  11. }
  12.  
  13. fn main() {
  14.     // -- SNIP --
  15.     let mut texture_table = TextureTable::new(&texture_creator);
  16.     // -- SNIP --
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement