mirl 9.2.0

Miners Rust Lib - A massive collection of ever growing and changing functions, structs, and enums. Check the description for compatibility and toggleable features! (Most of the lib is controlled by flags/features so the lib can continue to be lightweight despite its size)
use std::{rc::Rc, sync::Arc};

use crate::render::*;

impl<T: ?Sized + BufferMetrics> BufferMetrics for Arc<T> {
    fn width(&self) -> usize {
        (**self).width()
    }

    fn height(&self) -> usize {
        (**self).height()
    }
}

// impl<T: ?Sized + BufferPointers> BufferPointers for Arc<T> {
//     fn pointer(&self) -> *const u32 {
//         (**self).pointer()
//     }
//     //#[deprecated = "You cannot get a mutable pointer from Arc"]
//     fn mut_pointer(&mut self) -> *mut u32 {
//         panic!("Cannot get mutable pointer from Arc")
//     }
// }

impl<T: ?Sized + BufferGetPixel> BufferGetPixel for Arc<T> {
    fn get_pixel(&self, xy: (usize, usize)) -> u32 {
        (**self).get_pixel(xy)
    }

    fn get_pixel_option(&self, xy: (usize, usize)) -> Option<u32> {
        (**self).get_pixel_option(xy)
    }

    fn get_pixel_unsafe(&self, xy: (usize, usize)) -> u32 {
        (**self).get_pixel_unsafe(xy)
    }
}

impl<T: ?Sized + BufferMetrics> BufferMetrics for Box<T> {
    fn width(&self) -> usize {
        (**self).width()
    }

    fn height(&self) -> usize {
        (**self).height()
    }
}

impl<T: ?Sized + BufferPointers> BufferPointers for Box<T> {
    fn pointer(&self) -> *const u32 {
        (**self).pointer()
    }

    fn mut_pointer(&mut self) -> *mut u32 {
        (**self).mut_pointer()
    }
}

impl<T: ?Sized + BufferGetPixel> BufferGetPixel for Box<T> {
    fn get_pixel(&self, xy: (usize, usize)) -> u32 {
        (**self).get_pixel(xy)
    }

    fn get_pixel_option(&self, xy: (usize, usize)) -> Option<u32> {
        (**self).get_pixel_option(xy)
    }

    fn get_pixel_unsafe(&self, xy: (usize, usize)) -> u32 {
        (**self).get_pixel_unsafe(xy)
    }
}

impl<T: ?Sized + BufferMetrics> BufferMetrics for Rc<T> {
    fn width(&self) -> usize {
        (**self).width()
    }

    fn height(&self) -> usize {
        (**self).height()
    }
}

// impl<T: ?Sized + BufferPointers> BufferPointers for Rc<T> {
//     fn pointer(&self) -> *const u32 {
//         (**self).pointer()
//     }

//     fn mut_pointer(&mut self) -> *mut u32 {
//         panic!("Cannot get mutable pointer from Arc")
//     }
// }

impl<T: ?Sized + BufferGetPixel> BufferGetPixel for Rc<T> {
    fn get_pixel(&self, xy: (usize, usize)) -> u32 {
        (**self).get_pixel(xy)
    }

    fn get_pixel_option(&self, xy: (usize, usize)) -> Option<u32> {
        (**self).get_pixel_option(xy)
    }

    fn get_pixel_unsafe(&self, xy: (usize, usize)) -> u32 {
        (**self).get_pixel_unsafe(xy)
    }
}