I'm trying to find the best way to implement MVP pattern at RUST Language. Actually I'm using Clean Architecture pattern and now I'm trying implement MVP pattern inside. Whats the better way to do it?
For example: I have trait of some view:
pub trait ILoginView{
fn new(presenter: LoginPresenter) -> Self;
}
And some presenter for it:
pub struct LoginPresenter{
view: &mut dyn ILoginView,
}
Finally impl of view trait:
pub struct LoginView{
presenter: LoginPresenter,
}
impl ILoginView for LoginView{
fn new(presenter: LoginPresenter) -> Self {
Self{
presenter
}
}
}
And I don’t know how best to connect them with each other, so that the presenter, for example, changes the state of the view, and the view receives the login result.
P.S. I think that this question will be quite useful, because there are practically no answers to a similar question in the search results for Rust Lang.
Aucun commentaire:
Enregistrer un commentaire