Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lschuermann
Copy link
Member

Pull Request Overview

As an OptionalCell is designed to look like a Cell which can also be empty, the get method as currently implemented does not match the expected behavior (as it will return an Option<T> instead of a T). Furthermore, as OptionalCell::set takes simply a T (not wrapped in an Option), get should not return an Option<T>.

Accordingly, this commit renames the OptionalCell::get method to extract, to distinguish it from the Cell::get method.

Fixes: a845aa8 ("tock-cells/OptionalCell: add get-method...") (GitHub PR #2531)
Suggested-by: Brad Campbell [email protected]
Signed-off-by: Leon Schuermann [email protected]

Testing Strategy

This pull request was tested by compiling.

TODO or Help Wanted

A discussion about the right method name to use.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

As an OptionalCell is designed to look like a Cell which can also be
empty, the get method as currently implemented does not match the
expected behavior (as it will return an `Option<T>` instead of a `T`).
Furthermore, as `OptionalCell::set` takes simply a `T` (not wrapped in
an `Option`), `get` should not return an `Option<T>`.

Accordingly, this commit renames the `OptionalCell::get` method to
`extract`, to distinguish it from the `Cell::get` method.

Fixes: a845aa8 ("tock-cells/OptionalCell: add get-method...")
Suggested-by: Brad Campbell <[email protected]>
Signed-off-by: Leon Schuermann <[email protected]>
@lschuermann lschuermann added P-Upkeep This a relatively minor change, or one that is limited in scope, and requires less scrutiny. tock-libraries This affects libraries supported by the Tock project labels Apr 13, 2021
@bradjc
Copy link
Contributor

bradjc commented Apr 14, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 14, 2021

@bors bors bot merged commit 200954b into tock:master Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-Upkeep This a relatively minor change, or one that is limited in scope, and requires less scrutiny. tock-libraries This affects libraries supported by the Tock project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants