crates/veilvoice-policy/src/workspace.rs
veilvoice-policy · 817 lines · read the source here · or on GitHub
Named profiles and saved projects.
Two things, which sound alike and are not:
- A
Profileis a way of working, a named set of settings you can switch to. "Anonymise one person, as thoroughly as this can." "A group, everybody the same voice." Three are built in and you can save your own. - A
Workspaceis one piece of work: which recording, which plan, who is in it and what they are called, and the profile it was done under. Saved beside the recording, so opening it a week later puts everything back where it was.
Why a project file is worth having here in particular
Setting up a group recording is a dozen small decisions: who is in it, what each is called, what colour each is drawn in, whether they share a voice. Getting halfway through and having to stop is ordinary. Losing all of it because the window was closed is not, and it is worse than usual here, because the recording may be the only copy of something that cannot be made again.
Plain text, and the same shape as a plan
VEILWORK1, then one key value per line. The same format veilvoice-conversation uses for a plan, for the same reasons: it is readable, diffable, greppable, and has no syntax in which something surprising can hide. A project file is a description of your work; it should not require this program to read it.
What a project file does not contain
No audio and no passwords. It records the path to a recording, not the recording, and nothing about how anything is encrypted. A workspace is a thing you might send somebody so they can set their machine up the same way; if it carried a passphrase, sending it would be handing over the recordings too, and people would find that out afterwards.
Speaker names are in it, because the whole point is to put them back, and a name is a name. The file says so.
In plain words
This is the "save my project" and "load my setup" part.
Profiles are named ways of working you can flip between: one for anonymising a single person as thoroughly as possible, one for a group where everybody keeps their own disguised voice, one for a group where everybody sounds identical and only the names tell you who is speaking.
A project file remembers the rest: which recording you were working on, who is in it, what you called them and what colour each one is. Open it next week and everything is where you left it.
It does not contain the recording itself and it does not contain any password. It does contain the names you typed, because putting those back is the point of it.
WHAT THIS FILE CONTAINS
817 lines defining 13 functions (9 public), 4 types and 5 constants. Everything below is read out of the source, so it cannot disagree with the code.
The types it owns.
enum Errorline 70 · Something that could not be read.struct Profileline 96 · A named way of working.struct Memberline 209 · One person in a saved project.struct Workspaceline 218 · One piece of work, saved.
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.
Profile::applied_toline 125 · The engine settings this profile asks for, over a starting point.profileline 198 · The profile with this identifier.Workspace::loadline 412 · Read a project file.
reachesparse,new,take_token,default_profileWorkspace::saveline 419 · Write a project file, creating the directory if needed.
reachesto_text,one_lineWorkspace::profileline 439 · The profile this project names, if this build has it.
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_fmt["Error::fmt<br/>line 78"]
n_applied_to(["Profile::applied_to<br/>line 125"])
n_profile(["profile<br/>line 198"])
n_default_profile["default_profile<br/>line 203"]
n_new["Workspace::new<br/>line 237"]
n_to_text["Workspace::to_text<br/>line 251"]
n_parse["Workspace::parse<br/>line 314"]
n_load(["Workspace::load<br/>line 412"])
n_save(["Workspace::save<br/>line 419"])
n_profile(["Workspace::profile<br/>line 439"])
n_take_token["take_token<br/>line 448"]
n_one_line["one_line<br/>line 461"]
n_path_text["path_text<br/>line 466"]
n_load --> n_parse
n_new --> n_default_profile
n_parse --> n_new
n_parse --> n_take_token
n_path_text --> n_one_line
n_save --> n_to_text
n_to_text --> n_one_line
click n_fmt href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L78" "open the source"
click n_applied_to href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L125" "open the source"
click n_profile href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L198" "open the source"
click n_default_profile href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L203" "open the source"
click n_new href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L237" "open the source"
click n_to_text href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L251" "open the source"
click n_parse href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L314" "open the source"
click n_load href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L412" "open the source"
click n_save href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L419" "open the source"
click n_profile href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L439" "open the source"
click n_take_token href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L448" "open the source"
click n_one_line href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L461" "open the source"
click n_path_text href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-policy/src/workspace.rs#L466" "open the source"
classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
class n_applied_to,n_profile,n_load,n_save,n_profile entry
classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
class n_default_profile,n_new,n_to_text,n_parse api
classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
class n_fmt,n_take_token,n_one_line,n_path_text 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 |
|---|---|---|
MAGIC const | 66 | The first line of a project file. |
Error pub enum | 70 | Something that could not be read. |
Error::fmt fn | 78 | |
Profile pub struct | 96 | A named way of working. |
Profile::applied_to pub fn | 125 | The engine settings this profile asks for, over a starting point. |
INDIVIDUAL pub const | 134 | Anonymise one person, with everything this engine has turned on. |
GROUP_VOICES pub const | 152 | A group, each person with their own disguised voice. |
GROUP_ONE_VOICE pub const | 170 | A group where nobody can be picked out by sound at all. |
BUILT_IN pub const | 191 | The profiles that ship, in the order a picker shows them. |
profile pub fn | 198 | The profile with this identifier. |
default_profile pub fn | 203 | The profile a fresh install starts in. |
Member pub struct | 209 | One person in a saved project. |
Workspace pub struct | 218 | One piece of work, saved. |
Workspace::new pub fn | 237 | A new, empty project under the default profile. |
Workspace::to_text pub fn | 251 | Serialise to the text format. |
Workspace::parse pub fn | 314 | Parse the text format. |
Workspace::load pub fn | 412 | Read a project file. |
Workspace::save pub fn | 419 | Write a project file, creating the directory if needed. |
Workspace::profile pub fn | 439 | The profile this project names, if this build has it. |
take_token fn | 448 | The first whitespace-delimited token, and everything after it. |
one_line fn | 461 | A value with no line break in it. |
path_text fn | 466 | A path as one line, with Windows separators normalised. |