microsoft / security-utilities

Security utilities for key generation, string redaction, etc.
MIT License
24 stars 9 forks source link

Rust/His: Introduce ScanEngine struct #72

Closed beaubelgrave closed 2 months ago

beaubelgrave commented 2 months ago

Previously the Scan struct would track it's own state as well as allow external state operations. To do this though, it required a RefCell instance for the non-external state. This prevented the Scan struct from being fully used in scoped thread contexts without a Mutex or Arc.

Introduce the ScanEngine struct which contains all the same code as the Scan struct (rename) as before except for the internal state tracking.

Re-write the Scan struct to simply host the ScanEngine and a ScanState. This ensures the logic is the same as before, however, now we can completely drop the RefCell and make it much clearer for callers what we expect them to do.