Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- // or however you get your buffer
- let bufr = &mut [false; 64*32];
- // this wouldn't be done, but an example of destructure for the values
- let PixelBuffer {buf, size} = PixelBuffer::new(bufr, 64);
- println!("{:?} {:?}", buf, size);
- }
- pub struct PixelBuffer<'a> {
- pub buf: &'a mut [bool],
- pub size: usize
- }
- impl<'a> PixelBuffer<'a> {
- pub fn new(buf: &'a mut [bool], size: usize) -> Self {
- PixelBuffer {
- buf,
- size
- }
- }
- }
Add Comment
Please, Sign In to add comment