We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Listener<P>
Listener<Data = P>
The current trait use associate type to correlate between listener and intermediate payload.
pub trait Listener: Send + Sync { type Data; type S: Stream<Item = Self::Data> + Unpin + Send; fn into_stream(self) -> Self::S; }
This is suboptimal design. For example, let's say that raw payload from listener L can be turn into intermediate payload P (Data = P). Which mean
L
P
Data = P
impl Listener for L { type Data = P; ... }
Then, with this approach, it is not possible to make that listener to turn into other intermediate payload.
pub trait Listener<P>: Send + Sync { type S: Stream<Item = P> + Unpin + Send; fn into_stream(self) -> Self::S; }
With this implementation, it is possible to implement many intermediate payload for one type of listener.
impl Listener<P1> for L { ... } impl Listener<P2> for L { ... }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The current trait use associate type to correlate between listener and intermediate payload.
This is suboptimal design. For example, let's say that raw payload from listener
L
can be turn into intermediate payloadP
(Data = P
). Which meanThen, with this approach, it is not possible to make that listener to turn into other intermediate payload.
With this implementation, it is possible to implement many intermediate payload for one type of listener.
The text was updated successfully, but these errors were encountered: