Module omaha_client::unless

source ·
Expand description

The Unless trait for a more fluent use of Option::unwrap_or().

Specificially, this is intended to be used in cases where the “default” value is almost always the value in use, and the Option is rarely set.

// This implies that |some_option| is usually set, and "default" is there in case it's not.
let value = some_option.unwrap_or("default");

// Whereas this implies that "default" is the common case, and |some_option| is an override.
let value = "default".unless(some_option);

Traits