Skip to main content

NewTypeModel

Struct NewTypeModel 

Source
pub struct NewTypeModel {
    pub vis: Visibility,
    pub subject: Ident,
    pub generics: Generics,
    pub krate: Path,
    pub member: Member,
    pub inner: Type,
    pub kits: Kits,
}
Expand description

A declared NEWTYPE, as the device reads it.

Fields§

§vis: Visibility

The declaration’s own visibility, which a minted reading takes.

§subject: Ident

The newtype the faces are OF.

§generics: Generics

Its parameters, carried onto every emitted row.

§krate: Path

The ingraph root the expansion spells its shelf through.

§member: Member

The single field the value is held in — positional or named.

§inner: Type

That field’s type, which every pass-through delegates to.

§kits: Kits

The kits the declaration opted into.

Implementations§

Source§

impl NewTypeModel

Source

pub fn reading_name(&self) -> Ident

The reading this device mints for the filter kit — <Name>Wire.

Source

pub fn emit(&self) -> TokenStream

The whole device, emitted.

TWO scopes, and the split is the one every emitter here draws: a name the declaring scope has to be able to WRITE goes outside — the minted reading is named by an associated type a downstream crate resolves — and everything else goes inside an anonymous const, which is where an emission puts what it owes the declaring scope no name for.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.