Enum nannou::app::LoopMode[][src]

pub enum LoopMode {
    RefreshSync,
    Rate {
        update_interval: Duration,
    },
    Wait,
    NTimes {
        number_of_updates: usize,
    },
}
Expand description

The mode in which the App is currently running the event loop and emitting Update events.

Variants

RefreshSync

Synchronises Update events with requests for a new frame for the surface.

The result of using this loop mode is similar to using vsync in traditional applications. E.g. if you have one window running on a monitor with a 60hz refresh rate, your update will get called at a fairly consistent interval that is close to 60 times per second.

Rate

Specifies that the application is continuously looping at a consistent rate.

NOTE: This currently behaves the same as RefreshSync. Need to upate this to handled a fix step properly in the future. See #456.

Fields of Rate

update_interval: Duration

The minimum interval between emitted updates.

Wait

Waits for user input events to occur before calling event with an Update event.

This is particularly useful for low-energy GUIs that only need to update when some sort of input has occurred. The benefit of using this mode is that you don’t waste CPU cycles looping or updating when you know nothing is changing in your model or view.

NTimes

Loops for the given number of updates and then finishes.

This is similar to the Wait loop mode, except that windowing, application and input events will not cause the loop to update or view again after the initial number_of_updates have already been applied.

This is useful for sketches where you only want to draw one frame, or if you know exactly how many updates you require for an animation, etc.

Fields of NTimes

number_of_updates: usize

The number of updates that must be emited regardless of non-update events

Implementations

The minimum number of updates that will be emitted after an event is triggered in Wait mode.

A simplified constructor for the default RefreshSync loop mode.

Assumes a display refresh rate of ~60hz and in turn specifies a minimum_update_latency of ~8.33ms. The windows field is set to None.

Specify the Rate mode with the given frames-per-second.

Specify the Wait mode.

Specify the Ntimes mode with one update

Waits long enough to ensure loop iteration never occurs faster than the given max_fps.

Specify the Ntimes mode with one update

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert into T with values clamped to the color defined bounds Read more

Convert into T. The resulting color might be invalid in its color space Read more

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.