Anki/rslib/src
Damien Elmes 6941bccde4 Add support for proto3 optional scalars
Protobuf 3.15 introduced support for marking scalar fields like
uint32 as optional, and all of our tooling appears to support it
now. This allows us to use simple optional/null checks in our Rust/
TypeScript code, without having to resort to an inner message.

I had to apply a minor patch to protobufjs to get this working with
the json-module output; this has also been submitted upstream:
https://github.com/protobufjs/protobuf.js/pull/1693

I've modified CardStatsResponse as an example of the new syntax.

One thing to note: while the Rust and TypeScript bindings use optional/
null fields, as that is the norm in those languages, Google's Python
bindings are not very Pythonic. Referencing an optional field that is
missing will yield the default value, and a separate HasField() call
is required, eg:

```
>>> from anki.stats_pb2 import CardStatsResponse as R
... msg = R.FromString(b"")
... print(msg.first_review)
... print(msg.HasField("first_review"))
0
False
```
2022-02-27 19:42:06 +10:00
..
backend Original position (#1677) 2022-02-22 22:48:21 +10:00
card Make flag changes undoable again 2022-02-25 15:06:07 +10:00
card_rendering New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
collection don't put flag changes in the undo queue, and don't bump mtime 2022-02-13 16:27:33 +10:00
config Add option to ignore accents in search by default (#1667) 2022-02-17 16:30:52 +10:00
deckconfig Config for burying interday learning cards (#1680) 2022-02-22 21:37:59 +10:00
decks V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
error Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
media Garbage collect unused Fluent strings (#1482) 2021-11-12 18:19:01 +10:00
notes update to edition 2021 2021-11-18 20:51:10 +10:00
notetype Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
revlog Cap steps (#1548) 2021-12-15 18:46:26 +10:00
scheduler Original position (#1677) 2022-02-22 22:48:21 +10:00
search Add option to ignore accents in search by default (#1667) 2022-02-17 16:30:52 +10:00
stats Add support for proto3 optional scalars 2022-02-27 19:42:06 +10:00
storage Original position (#1677) 2022-02-22 22:48:21 +10:00
sync Original position (#1677) 2022-02-22 22:48:21 +10:00
tags fix Clippy lints in Rust 1.57 2021-12-03 19:53:37 +10:00
undo update undo skipping; exclude deck/tag expand/collapse 2021-06-25 09:16:15 +10:00
adding.rs expose undoable config changes to frontend; refresh sidebar 2021-05-21 17:50:41 +10:00
backend_proto.rs Add links.proto and backend module 2021-07-22 10:05:38 +02:00
browser_table.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
cloze.rs Add check for out-of-place/missing clozes 2021-06-12 10:02:21 +02:00
dbcheck.rs Skip new notetype checks when importing apkg 2021-07-28 21:46:51 +02:00
findreplace.rs Remove redundant error mapping (#1593) 2022-01-16 13:46:27 +10:00
i18n.rs drop the legacy enum from rslib, and pass separate module/message idx 2021-03-27 11:56:31 +10:00
latex.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00
lib.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
links.rs fix a link anchor 2021-11-14 11:44:54 +10:00
log.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00
markdown.rs render deck description with markdown; strip images 2021-02-06 15:02:40 +10:00
ops.rs Make flag changes undoable again 2022-02-25 15:06:07 +10:00
preferences.rs Add option to ignore accents in search by default (#1667) 2022-02-17 16:30:52 +10:00
prelude.rs Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
serde.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00
template.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
template_filters.rs New TTS/AV tag handling (#1559) 2021-12-17 19:04:42 +10:00
text.rs Optimise searching in (all) fields (#1622) 2022-01-24 20:30:08 +10:00
timestamp.rs fix test scheduler undo + implement look-ahead 2021-05-14 22:16:53 +10:00
types.rs update scheduling ops 2021-04-06 16:38:42 +10:00
version.rs tidy up Rust imports 2021-04-18 18:38:54 +10:00