Skip to main content

add_profile

Function add_profile 

Source
pub fn add_profile(
    paths: &WorkspacePaths,
    name: &str,
    added: Date,
) -> Result<WorkspaceFile, Diagnostic>
Expand description

Records in the workspace at paths that it carries the profile name, added on added, and answers with the file as it now stands.

The file is read again first rather than written from what a screen remembers, so whatever was changed in it since the screen read it — by hand, or by another window — is kept. A profile the file already names is left as it is, with its own date.

Runs file work, so it belongs on a background thread.

§Errors

A diagnostic when the file cannot be read, names no usable workspace, or cannot be written.