Struct dae_parser::Ref

source ·
#[repr(transparent)]
pub struct Ref<A, T: ?Sized> { pub val: A, /* private fields */ }
Expand description

A wrapper around a base type A to indicate that the value is pointing to a value of type T.

This is not a strict type safety barrier; it is possible to convert a Ref to and from its raw version. However this can help in API documentation, as well as to assist type inference in functions like LocalMap::get.

Fields§

§val: A

The underlying storage or “raw” value.

Implementations§

source§

impl<A, T: ?Sized> Ref<A, T>

source

pub fn new(val: A) -> Self

Construct a new Ref by wrapping a raw value.

Trait Implementations§

source§

impl<A: Clone, T: Clone + ?Sized> Clone for Ref<A, T>

source§

fn clone(&self) -> Ref<A, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A: Debug, T: ?Sized> Debug for Ref<A, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A, T: ?Sized> Deref for Ref<A, T>

§

type Target = A

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<A: Display, T: ?Sized> Display for Ref<A, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A: FromStr, T: ?Sized> FromStr for Ref<A, T>

§

type Err = <A as FromStr>::Err

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<'a, T: ?Sized> Index<&Ref<String, T>> for LocalMap<'a, T>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: &NameRef<T>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, T: HasId + ?Sized> Index<&Ref<String, T>> for LocalMaps<'a>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: &NameRef<T>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, T: ?Sized> Index<&Ref<Url, T>> for LocalMap<'a, T>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: &UrlRef<T>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, T: HasId + ?Sized> Index<&Ref<Url, T>> for LocalMaps<'a>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: &UrlRef<T>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<A, T: ?Sized> RefCast for Ref<A, T>

§

type From = A

source§

fn ref_cast(_from: &Self::From) -> &Self

source§

fn ref_cast_mut(_from: &mut Self::From) -> &mut Self

source§

impl<A: Copy, T: Copy + ?Sized> Copy for Ref<A, T>

Auto Trait Implementations§

§

impl<A, T: ?Sized> RefUnwindSafe for Ref<A, T>where A: RefUnwindSafe, T: RefUnwindSafe,

§

impl<A, T: ?Sized> Send for Ref<A, T>where A: Send, T: Send,

§

impl<A, T: ?Sized> Sync for Ref<A, T>where A: Sync, T: Sync,

§

impl<A, T: ?Sized> Unpin for Ref<A, T>where A: Unpin, T: Unpin,

§

impl<A, T: ?Sized> UnwindSafe for Ref<A, T>where A: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.