Struct Context

Source
pub struct Context<T>
where T: FlavorTranslator<Source = CoreFlavor>,
{ pub flavor: T, pub types: Rc<LinkedHashMap<RpName<T::Source>, Loc<RpReg>>>, pub decls: Option<RefCell<LinkedHashMap<RpName<T::Source>, RpReg>>>, }
Expand description

Context used when translating.

Fields§

§flavor: T

Type used to translate types.

§types: Rc<LinkedHashMap<RpName<T::Source>, Loc<RpReg>>>

Registered declarations of the source type.

§decls: Option<RefCell<LinkedHashMap<RpName<T::Source>, RpReg>>>

Cached and translated registered declarations.

Trait Implementations§

Source§

impl<T> Translator for Context<T>
where T: FlavorTranslator<Source = CoreFlavor>,

Source§

fn visit( &self, diag: &mut Diagnostics, name: &Loc<RpName<Self::Source>>, ) -> Result<()>

Indicate that the given name has been visited.

Source§

fn translate_local_name( &self, diag: &mut Diagnostics, reg: RpReg, name: <Self::Source as Flavor>::Name, ) -> Result<<Self::Target as Flavor>::Name>

Translate a local declaration name.

Source§

fn translate_enum_type( &self, diag: &mut Diagnostics, enum_type: <Self::Source as Flavor>::EnumType, ) -> Result<<Self::Target as Flavor>::EnumType>

Translate enum type.

Source§

type Source = <T as FlavorTranslator>::Source

Source§

type Target = <T as FlavorTranslator>::Target

Source§

fn translate_package( &self, source: <Self::Source as Flavor>::Package, ) -> Result<<Self::Target as Flavor>::Package>

Translate the given package from one flavor to another.
Source§

fn translate_type( &self, diag: &mut Diagnostics, source: <Self::Source as Flavor>::Type, ) -> Result<<Self::Target as Flavor>::Type>

Translate the given type from one flavor to another.
Source§

fn translate_field( &self, diag: &mut Diagnostics, source: <Self::Source as Flavor>::Field, ) -> Result<<Self::Target as Flavor>::Field>

Translate the given field from one flavor to another.
Source§

fn translate_endpoint( &self, diag: &mut Diagnostics, source: <Self::Source as Flavor>::Endpoint, ) -> Result<<Self::Target as Flavor>::Endpoint>

Translate the given endpoint from one flavor to another.

Auto Trait Implementations§

§

impl<T> !Freeze for Context<T>

§

impl<T> !RefUnwindSafe for Context<T>

§

impl<T> !Send for Context<T>

§

impl<T> !Sync for Context<T>

§

impl<T> Unpin for Context<T>
where T: Unpin,

§

impl<T> UnwindSafe for Context<T>
where T: UnwindSafe,

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.