pub trait Translator {
type Source: 'static + Flavor;
type Target: 'static + Flavor;
// Required methods
fn translate_package(
&self,
_: <Self::Source as Flavor>::Package,
) -> Result<<Self::Target as Flavor>::Package>;
fn translate_type(
&self,
diag: &mut Diagnostics,
_: <Self::Source as Flavor>::Type,
) -> Result<<Self::Target as Flavor>::Type>;
fn translate_field(
&self,
diag: &mut Diagnostics,
_: <Self::Source as Flavor>::Field,
) -> Result<<Self::Target as Flavor>::Field>;
fn translate_endpoint(
&self,
diag: &mut Diagnostics,
_: <Self::Source as Flavor>::Endpoint,
) -> Result<<Self::Target as Flavor>::Endpoint>;
fn translate_local_name(
&self,
diag: &mut Diagnostics,
reg: RpReg,
name: <Self::Source as Flavor>::Name,
) -> Result<<Self::Target as Flavor>::Name>;
fn translate_enum_type(
&self,
diag: &mut Diagnostics,
enum_type: <Self::Source as Flavor>::EnumType,
) -> Result<<Self::Target as Flavor>::EnumType>;
// Provided method
fn visit(
&self,
_: &mut Diagnostics,
_: &<Self::Source as Flavor>::Name,
) -> Result<()> { ... }
}Expand description
Translator trait from one flavor to another.
Required Associated Types§
Required Methods§
Sourcefn translate_package(
&self,
_: <Self::Source as Flavor>::Package,
) -> Result<<Self::Target as Flavor>::Package>
fn translate_package( &self, _: <Self::Source as Flavor>::Package, ) -> Result<<Self::Target as Flavor>::Package>
Translate the given package from one flavor to another.
Sourcefn translate_type(
&self,
diag: &mut Diagnostics,
_: <Self::Source as Flavor>::Type,
) -> Result<<Self::Target as Flavor>::Type>
fn translate_type( &self, diag: &mut Diagnostics, _: <Self::Source as Flavor>::Type, ) -> Result<<Self::Target as Flavor>::Type>
Translate the given type from one flavor to another.
Sourcefn translate_field(
&self,
diag: &mut Diagnostics,
_: <Self::Source as Flavor>::Field,
) -> Result<<Self::Target as Flavor>::Field>
fn translate_field( &self, diag: &mut Diagnostics, _: <Self::Source as Flavor>::Field, ) -> Result<<Self::Target as Flavor>::Field>
Translate the given field from one flavor to another.
Sourcefn translate_endpoint(
&self,
diag: &mut Diagnostics,
_: <Self::Source as Flavor>::Endpoint,
) -> Result<<Self::Target as Flavor>::Endpoint>
fn translate_endpoint( &self, diag: &mut Diagnostics, _: <Self::Source as Flavor>::Endpoint, ) -> Result<<Self::Target as Flavor>::Endpoint>
Translate the given endpoint from one flavor to another.
Sourcefn 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.
Sourcefn 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>
Enum type to translate.