[][src]Trait rowan::TransparentNewType

pub unsafe trait TransparentNewType: Sized {
    type Repr;
    fn from_repr(repr: &Self::Repr) -> &Self { ... }
fn into_repr(&self) -> &Self::Repr { ... } }

A marker trait for transparent newtypes.

If you declare a struct like

#[repr(transparent)]
struct Wrapper(Inner)

it is safe to add

unsafe impl TransparentNewType for Wrapper { type Repr = Inner; }

Implementing this trait allows one to cast safely between the wrapper and the underlying representation.

Associated Types

type Repr

Underlying representation of a newtype.

Loading content...

Provided methods

fn from_repr(repr: &Self::Repr) -> &Self

Cast the underlying repr into a wrapper.

fn into_repr(&self) -> &Self::Repr

Cast wrapper to the underlying repr.

Loading content...

Implementors

impl<T: Types> TransparentNewType for SyntaxNode<T>
[src]

type Repr = SyntaxNode<T>

Loading content...