pub trait Transport {
type TSS: TypeSystem;
type TSD: TypeSystem;
type S: Source;
type D: Destination;
type Error: From<ConnectorXError> + From<<Self::S as Source>::Error> + From<<Self::D as Destination>::Error> + Send + Debug;
// Required methods
fn convert_typesystem(ts: Self::TSS) -> CXResult<Self::TSD>;
fn process<'s, 'd, 'r>(
ts1: Self::TSS,
ts2: Self::TSD,
src: &'r mut <<Self::S as Source>::Partition as SourcePartition>::Parser<'s>,
dst: &'r mut <Self::D as Destination>::Partition<'d>,
) -> Result<(), Self::Error>
where Self: 'd;
fn processor<'s, 'd>(
ts1: Self::TSS,
ts2: Self::TSD,
) -> CXResult<fn(src: &mut <<Self::S as Source>::Partition as SourcePartition>::Parser<'s>, dst: &mut <Self::D as Destination>::Partition<'d>) -> Result<(), Self::Error>>
where Self: 'd;
// Provided method
fn convert_type<T1, T2>(val: T1) -> T2
where Self: TypeConversion<T1, T2> { ... }
}
Expand description
Transport asks the source to produce a value, do type conversion and then write
the value to a destination. Do not manually implement this trait for types.
Use [impl_transport!
] to create a struct that implements this trait instead.
Required Associated Types§
type TSS: TypeSystem
type TSD: TypeSystem
type S: Source
type D: Destination
type Error: From<ConnectorXError> + From<<Self::S as Source>::Error> + From<<Self::D as Destination>::Error> + Send + Debug
Required Methods§
sourcefn convert_typesystem(ts: Self::TSS) -> CXResult<Self::TSD>
fn convert_typesystem(ts: Self::TSS) -> CXResult<Self::TSD>
convert_typesystem convert the source type system TSS to the destination type system TSD.
sourcefn process<'s, 'd, 'r>(
ts1: Self::TSS,
ts2: Self::TSD,
src: &'r mut <<Self::S as Source>::Partition as SourcePartition>::Parser<'s>,
dst: &'r mut <Self::D as Destination>::Partition<'d>,
) -> Result<(), Self::Error>where
Self: 'd,
fn process<'s, 'd, 'r>(
ts1: Self::TSS,
ts2: Self::TSD,
src: &'r mut <<Self::S as Source>::Partition as SourcePartition>::Parser<'s>,
dst: &'r mut <Self::D as Destination>::Partition<'d>,
) -> Result<(), Self::Error>where
Self: 'd,
process
will ask source to produce a value with type T1, based on TSS, and then do
type conversion using convert_type
to get value with type T2, which is associated to
TSD. Finally, it will write the value with type T2 to the destination.
fn processor<'s, 'd>(
ts1: Self::TSS,
ts2: Self::TSD,
) -> CXResult<fn(src: &mut <<Self::S as Source>::Partition as SourcePartition>::Parser<'s>, dst: &mut <Self::D as Destination>::Partition<'d>) -> Result<(), Self::Error>>where
Self: 'd,
Provided Methods§
sourcefn convert_type<T1, T2>(val: T1) -> T2where
Self: TypeConversion<T1, T2>,
fn convert_type<T1, T2>(val: T1) -> T2where
Self: TypeConversion<T1, T2>,
convert_type convert the type T1 associated with the source type system TSS to a type T2 which is associated with the destination type system TSD.
Object Safety§
This trait is not object safe.