Skip to content

Commit

Permalink
Update documentation to reflect changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Aug 26, 2023
1 parent 161ef4f commit fcff1d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

#### Breaking changes

- `pre_run` and `post_run` on `EventSource` have been replaced with `before_will_sleep` and `before_handle_events`, respectively.
These are now opt-in through the `NEEDS_EXTRA_LIFECYCLE_EVENTS` associated constant, and occur at slightly different times to
the methods they are replacing. This allows greater compatibility with Wayland based event sources.

## 0.11.0 -- 2023-06-05

#### Bugfixes
Expand Down
15 changes: 11 additions & 4 deletions src/sources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,17 @@ impl BitOrAssign for PostAction {
///
/// In case your event source needs to do some special processing before or after a
/// polling session occurs (to prepare the underlying source for polling, and cleanup
/// after that), you can override the `pre_run` and `post_run`, that do nothing by
/// default. Depending on the underlying events, `process_events` may be invoked once,
/// several times, or none at all between `pre_run` and `post_run` are called, but when
/// it is invoked, it'll always be between those two.
/// after that), you can override [`NEEDS_EXTRA_LIFECYCLE_EVENTS`] to `true`.
/// For all sources for which that constant is `true`, the methods [`before_will_sleep`] and
/// [`before_handle_events`] will be called.
/// [`before_will_sleep`] is called before the polling system performs a poll operation.
/// [`before_handle_events`] is called before any process_events methods have been called.
/// This means that during `process_events` you can assume that all cleanup has occured on
/// all sources.
///
/// [`NEEDS_EXTRA_LIFECYCLE_EVENTS`]: EventSource::NEEDS_EXTRA_LIFECYCLE_EVENTS
/// [`before_will_sleep`]: EventSource::before_will_sleep
/// [`before_handle_events`]: EventSource::before_handle_events
pub trait EventSource {
/// The type of events generated by your source.
type Event;
Expand Down

0 comments on commit fcff1d7

Please sign in to comment.