Skip to content
Discussion options

You must be logged in to vote

Hi, and thanks for the question!

First, you may be interested in the FocusTracker wrapper, which may help set callbacks for focus events.

Second, the double-borrow happens because you call find_name on self.view (the NamedView) while you're borrowing the layout. But you could directly call find_name on the layout instead. For that you do need the view to be un-borrowed.

You borrow it to prepare a string. Since the string itself doesn't borrow the view, you could first build the string while borrowing the view, then only keep the string, and use it to set the content:

fn wrap_on_event(&mut self, ch: Event) -> EventResult {
    let output = self.with_view_mut(|view| view.on_event(ch));
    s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vitorqb
Comment options

Answer selected by vitorqb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants