Skip to content
Discussion options

You must be logged in to vote

set_on_pre_event_inner is the low-level method that set_on_pre_event calls internally. The callback works in two steps:

  • First, in the closure you pass, you have access to the event, but not to &mut Cursive. You need to decide here if the event should be consumed. In doubt, consume the event.
  • The closure returns a EventResult, which itself can contain a callback using EventResult::with_cb. That callback will have access to &mut Cursive, and you can move the event in there.

If you can decide to consume or ignore the event without access to &mut Cursive (and just need access to it in case you consume the event), then you're good - it's the "easy" case.

cursive.set_on_pre_event_inner(EventT…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gyscos
Comment options

Answer selected by rcook
@rcook
Comment options

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