Trait handles::Handle

source ·
pub trait Handle: Any {
    type R: Resource;

    // Required methods
    fn wrap(r: Self::R) -> Self
       where Self: Sized;
    fn clone_handle(&self) -> Result<Self, <Self::R as Resource>::Error>
       where Self: Sized;
    fn boxed_clone_handle(
        &self
    ) -> Result<Box<dyn Handle<R = Self::R>>, <Self::R as Resource>::Error>;
    fn handle_ref(&self) -> &Self::R;
    fn get_mut(&mut self) -> Option<&mut Self::R>;
    fn ensure_exclusive(&mut self) -> Result<(), <Self::R as Resource>::Error>;

    // Provided methods
    fn eq_ref(&self, other: &dyn Handle<R = Self::R>) -> bool { ... }
    fn make_mut(&mut self) -> Result<&mut Self::R, <Self::R as Resource>::Error> { ... }
}

Required Associated Types§

Required Methods§

source

fn wrap(r: Self::R) -> Self
where Self: Sized,

source

fn clone_handle(&self) -> Result<Self, <Self::R as Resource>::Error>
where Self: Sized,

source

fn boxed_clone_handle( &self ) -> Result<Box<dyn Handle<R = Self::R>>, <Self::R as Resource>::Error>

source

fn handle_ref(&self) -> &Self::R

source

fn get_mut(&mut self) -> Option<&mut Self::R>

source

fn ensure_exclusive(&mut self) -> Result<(), <Self::R as Resource>::Error>

Provided Methods§

source

fn eq_ref(&self, other: &dyn Handle<R = Self::R>) -> bool

source

fn make_mut(&mut self) -> Result<&mut Self::R, <Self::R as Resource>::Error>

Implementations on Foreign Types§

source§

impl<R: Resource> Handle for Rc<R>

§

type R = R

source§

fn wrap(r: Self::R) -> Self
where Self: Sized,

source§

fn clone_handle(&self) -> Result<Self, <Self::R as Resource>::Error>
where Self: Sized,

source§

fn boxed_clone_handle( &self ) -> Result<Box<dyn Handle<R = Self::R>>, <Self::R as Resource>::Error>

source§

fn handle_ref(&self) -> &Self::R

source§

fn get_mut(&mut self) -> Option<&mut Self::R>

source§

fn ensure_exclusive(&mut self) -> Result<(), <Self::R as Resource>::Error>

source§

impl<R: Resource> Handle for Arc<R>

§

type R = R

source§

fn wrap(r: Self::R) -> Self
where Self: Sized,

source§

fn clone_handle(&self) -> Result<Self, <Self::R as Resource>::Error>
where Self: Sized,

source§

fn boxed_clone_handle( &self ) -> Result<Box<dyn Handle<R = Self::R>>, <Self::R as Resource>::Error>

source§

fn handle_ref(&self) -> &Self::R

source§

fn get_mut(&mut self) -> Option<&mut Self::R>

source§

fn ensure_exclusive(&mut self) -> Result<(), <Self::R as Resource>::Error>

Implementors§

source§

impl<R: Resource> Handle for R

§

type R = R