use std::ops::Deref; use std::sync::Arc; use inspection::Repr; /// A shared immutable handle to an abstract shape. #[derive(Clone)] pub struct ShapeHandle
{
handle: Arc ShapeHandle {
/// Creates a sharable shape handle from a shape.
#[inline]
pub fn new {
ShapeHandle {
handle: Arc::new(Box::new(shape) as Box AsRef {
#[inline]
fn as_ref(&self) -> &Repr {
self.deref()
}
}
impl Deref for ShapeHandle {
type Target = Repr ;
#[inline]
fn deref(&self) -> &Repr {
&**self.handle
}
}