crates/veilvoice-gui/src/reset.rs
veilvoice-gui · 604 lines · read the source here · or on GitHub
Starting again from the window: what would go, then going.
Two steps, always, and never one
Look, then agree. veilvoice_crypto::reset::plan answers what is in the folder and how much of it there is, that answer is drawn, and only then is there a button that removes anything. There is no path through this module that deletes on one press, because "reset" is a word people press before they have finished reading it.
Where the plan holds something nothing can put back -- recordings, colour schemes somebody wrote -- the word RESET has to be typed, exactly as veilvoice reset asks for it at a terminal and for the same reason: a button is a thing a hand does and a word is a thing a person does.
Off the drawing thread
Both halves go to a worker. Counting a vault means walking a directory and removing one means unlinking every file in it, and a window that stops answering in the middle of deleting somebody's recordings is a window they will assume has broken. The same shape crate::integrity uses, and the thread is detached for the same reason: there is nothing to join.
What it does not do
It does not close VeilVoice by itself. The report is the part worth reading and a window that vanishes as the last file goes has thrown it away, so closing is a button underneath it. Until that is pressed the window is holding settings that no longer exist on disk, which is harmless and is exactly why the button says what it says.
In plain words
Puts VeilVoice back to how it was when you installed it. It shows you everything it is about to remove, with how big it is, before it removes any of it, and it can leave your password and the key to your recordings alone.
WHAT THIS FILE CONTAINS
604 lines defining 13 functions (3 public), 3 types and 1 constant. Everything below is read out of the source, so it cannot disagree with the code.
The types it owns.
enum Stateline 51 · Where the reset is up to.enum Answerline 67 · What a worker sends back.struct Resetline 75 · The reset, as the window holds it.
What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.
Reset::is_busyline 101 · Whether a worker is running, so the window keeps repainting.Reset::pollline 107 · Collect a finished worker.Reset::panelline 190 · Draw it.
reachesagree,finished,offer,carry_out,files,may_proceed,size,look,keep
WHAT CALLS WHAT
The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.
The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
n_default["Reset::default<br/>line 87"]
n_is_busy(["Reset::is_busy<br/>line 101"])
n_poll(["Reset::poll<br/>line 107"])
n_look["Reset::look<br/>line 138"]
n_carry_out["Reset::carry_out<br/>line 159"]
n_keep["Reset::keep<br/>line 172"]
n_may_proceed["Reset::may_proceed<br/>line 185"]
n_panel(["Reset::panel<br/>line 190"])
n_offer["Reset::offer<br/>line 223"]
n_agree["Reset::agree<br/>line 244"]
n_finished["Reset::finished<br/>line 401"]
n_files["files<br/>line 442"]
n_size["size<br/>line 455"]
n_agree --> n_carry_out
n_agree --> n_files
n_agree --> n_may_proceed
n_agree --> n_size
n_look --> n_keep
n_offer --> n_look
n_panel --> n_agree
n_panel --> n_finished
n_panel --> n_offer
click n_default href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L87" "open the source"
click n_is_busy href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L101" "open the source"
click n_poll href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L107" "open the source"
click n_look href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L138" "open the source"
click n_carry_out href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L159" "open the source"
click n_keep href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L172" "open the source"
click n_may_proceed href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L185" "open the source"
click n_panel href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L190" "open the source"
click n_offer href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L223" "open the source"
click n_agree href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L244" "open the source"
click n_finished href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L401" "open the source"
click n_files href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L442" "open the source"
click n_size href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/reset.rs#L455" "open the source"
classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
class n_is_busy,n_poll,n_panel entry
classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
class n_default,n_look,n_carry_out,n_keep,n_may_proceed,n_offer,n_agree,n_finished,n_files,n_size helper
subgraph chart_key ["Key"]
direction LR
key_entry["entry: a way in: public, and nothing in this file calls it"]
key_helper["helper: private to this file"]
end
class key_entry entry
class key_helper helper
This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.
ITEMS
| Item | Line | Documentation |
|---|---|---|
TYPED pub const | 48 | The word somebody types where the plan cannot be undone. |
State enum | 51 | Where the reset is up to. |
Answer enum | 67 | What a worker sends back. |
Reset pub struct | 75 | The reset, as the window holds it. |
Reset::default fn | 87 | |
Reset::is_busy pub fn | 101 | Whether a worker is running, so the window keeps repainting. |
Reset::poll pub fn | 107 | Collect a finished worker. |
Reset::look fn | 138 | Ask a worker what is there. |
Reset::carry_out fn | 159 | Ask a worker to carry out a plan it has been shown. |
Reset::keep fn | 172 | Which reset the checkbox is currently asking for. |
Reset::may_proceed fn | 185 | Whether the plan on screen may be carried out yet. |
Reset::panel pub fn | 190 | Draw it. |
Reset::offer fn | 223 | The offer, before anything has been counted. |
Reset::agree fn | 244 | The plan, and the decision. |
Reset::finished fn | 401 | What happened, and the way out. |
files fn | 442 | "one file" or "nine files". |
size fn | 455 | A size somebody can judge at a glance. |