Struct DataReferenceGeneric

Source
pub struct DataReferenceGeneric { /* private fields */ }
Expand description

A Genericized version of DataReference<T>

This type can be safely passed around without knowing the inner of a DataReference. DataReferenceGeneric will track ref count just as DataReference, however the innner data cannot be accessed without first converting back into DataReference<T>.

Implements From<DataReference>

Implementations§

Source§

impl DataReferenceGeneric

Source

pub fn type_id(&self) -> TypeId

The TypeId of the associated DataReference<T>, literally TypeId::of::<DataReference<T>>()

Source

pub fn inner_type_id(&self) -> TypeId

The TypeId of the inner type T of the associated DataReference<T>. If this DataReferenceGeneric is associated with DataReference<T>, this would be the result of TypeId::of::<T>()

Source

pub fn to_typed<T: 'static>(&self) -> Option<DataReference<T>>

For a given type T, create a DataReference<T> if and only if T matches the type that was used to create this DataReferenceGeneric, otherwise None

This increments the ref count if Some is returned

Trait Implementations§

Source§

impl Drop for DataReferenceGeneric

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: 'static> From<DataReference<T>> for DataReferenceGeneric

Source§

fn from(source: DataReference<T>) -> Self

Converts to this type from the input type.
Source§

impl Send for DataReferenceGeneric

Source§

impl Sync for DataReferenceGeneric

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.