-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert impl Condition
return signature to Option<bool>
#1498
base: main
Are you sure you want to change the base?
Conversation
Takes advantage of `?` on `Option` to allow simpler `Condition` impls. Not a huge change internally, but it is a breaking change. Signed-off-by: clux <[email protected]>
Condition
in terms of option functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lookup of the conditions is one of the most common scenarios in controller code. If anything can make it simpler, I think it is worth implementing.
Signed-off-by: clux <[email protected]>
Signed-off-by: clux <[email protected]>
Condition
in terms of option functionsCondition
to fns returning Option<bool>
less breaking for people using it because the signature is the same! Signed-off-by: clux <[email protected]>
Signed-off-by: clux <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1498 +/- ##
=======================================
- Coverage 76.1% 76.0% -0.0%
=======================================
Files 84 84
Lines 7859 7843 -16
=======================================
- Hits 5976 5960 -16
Misses 1883 1883
🚀 New features to boost your workflow:
|
Signed-off-by: clux <[email protected]>
I have revamped this after seeing new verbose |
Condition
to fns returning Option<bool>
impl Condition
to return signature to Option<bool>
impl Condition
to return signature to Option<bool>
impl Condition
return signature to Option<bool>
To allow taking advantage of
?
onOption
to allow simplerCondition
impls.This also technically allows for distinguishing between;
Generally, this is probably not hugely valuable, but it allows us to have a clearer answer rather than to conflate
missing
with either true or false.Breaking
This is generally not a breaking change. The
matches_object
fn retains its original signature + behavior. It does this by using the new trait methodmatches
withunwrap_or_default
:However;
This is a breaking change only for implementors of
Condition
who now need to return anOption<bool>
rather thanbool
forimpl Condition
. My thinking is that being able to use option-try makes this worth it. It can be easily communicated that you take the value and put it in aSome
otherwise.This is also a slight breaking change for the newly introduced (#1710)
conditions::is_service_loadbalancer_provisioned
which was returningtrue
for services the condition did not apply for. Now it returnsSome(false)
for such services.