Trait cxx::memory::SharedPtrTarget[][src]

pub unsafe trait SharedPtrTarget { }

Trait bound for types which may be used as the T inside of a SharedPtr<T> in generic code.

This trait has no publicly callable or implementable methods. Implementing it outside of the CXX codebase is not supported.

Example

A bound T: SharedPtrTarget may be necessary when manipulating SharedPtr in generic code.

use cxx::memory::{SharedPtr, SharedPtrTarget};
use std::fmt::Display;

pub fn take_generic_ptr<T>(ptr: SharedPtr<T>)
where
    T: SharedPtrTarget + Display,
{
    println!("the shared_ptr points to: {}", *ptr);
}

Writing the same generic function without a SharedPtrTarget trait bound would not compile.

Implementations on Foreign Types

impl SharedPtrTarget for bool[src]

impl SharedPtrTarget for u8[src]

impl SharedPtrTarget for u16[src]

impl SharedPtrTarget for u32[src]

impl SharedPtrTarget for u64[src]

impl SharedPtrTarget for usize[src]

impl SharedPtrTarget for i8[src]

impl SharedPtrTarget for i16[src]

impl SharedPtrTarget for i32[src]

impl SharedPtrTarget for i64[src]

impl SharedPtrTarget for isize[src]

impl SharedPtrTarget for f32[src]

impl SharedPtrTarget for f64[src]

Loading content...

Implementors

Loading content...