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>,
impl<T> Translator for Context<T>where
T: FlavorTranslator<Source = CoreFlavor>,
Source§fn visit(
&self,
diag: &mut Diagnostics,
name: &Loc<RpName<Self::Source>>,
) -> Result<()>
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>
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>
fn translate_enum_type( &self, diag: &mut Diagnostics, enum_type: <Self::Source as Flavor>::EnumType, ) -> Result<<Self::Target as Flavor>::EnumType>
Translate enum type.
type Source = <T as FlavorTranslator>::Source
type Target = <T as FlavorTranslator>::Target
Source§fn translate_package(
&self,
source: <Self::Source as Flavor>::Package,
) -> Result<<Self::Target as Flavor>::Package>
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>
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.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more