diondokter / at-commands

Rust project for building and parsing at commands
Apache License 2.0
33 stars 5 forks source link

add support for optional parser parameters #9

Closed tarfu closed 1 year ago

tarfu commented 1 year ago

This should be a discussion starter for an implementation for #7. It is mostly a copy of the existing methods and tweaking them a bit.

I would also replace the implementation of the none optional counterparts with the optional ones and just wrap it with a None check.

diondokter commented 1 year ago

Hi! Thanks for working on this :)

7 didn't really talk about this, but more like if an at command has e.g. either 3 or 6 parameters depending on some condition.

However, the thing you're implementing here also does happen so it's a good feature to have. One thing though is that I don't really like the amount of duplicated code. It would be nice if it could be refactored so that the non-optional functions would simply use the optional functions. That way going forward the maintenance will be easier.

tarfu commented 1 year ago

The way of the refactoring was chosen because if we used the optional methods directly we would already have added the response to the tucat and this would break the API as the non-optional would also return an Option.

diondokter commented 1 year ago

Oh that was quick, thanks!

Once the other open PR is merged, I'll make a new release :)

diondokter commented 1 year ago

Now released as 0.5.4