pub struct WorkspaceFile { /* private fields */ }Expand description
Safe wrapper for TestStand™ WorkspaceFile (IWorkspaceFile).
Implementations§
Source§impl WorkspaceFile
impl WorkspaceFile
Sourcepub fn as_property_object_file(&self) -> Result<PropertyObjectFile, Error>
pub fn as_property_object_file(&self) -> Result<PropertyObjectFile, Error>
Sourcepub fn root_workspace_object(&self) -> Result<WorkspaceObject, Error>
pub fn root_workspace_object(&self) -> Result<WorkspaceObject, Error>
Accesses the root workspace object (WorkspaceFile.RootWorkspaceObject).
§Errors
Error if the COM call fails or returns an unexpected type.
Examples found in repository?
5fn main() -> Result<(), rs_teststand::Error> {
6 let engine = Engine::new()?;
7
8 println!("Creating a new workspace file...");
9 let ws_file = engine.new_workspace_file()?;
10 let root_obj = ws_file.root_workspace_object()?;
11
12 println!("Root workspace object:");
13 println!(" Display Name: '{}'", root_obj.display_name()?);
14 println!(" Object Type: {}", root_obj.object_type()?);
15 println!(" Child Objects: {}", root_obj.num_contained_objects()?);
16
17 println!("\nCreating project and folder structure...");
18 let project = root_obj.new_folder("Project Alpha")?;
19 println!(" Created project folder: '{}'", project.display_name()?);
20
21 let seq_entry = project.new_file("MainTest.seq")?;
22 println!(
23 " Created sequence file entry: '{}'",
24 seq_entry.display_name()?
25 );
26
27 println!(
28 "\nUpdated root child objects count: {}",
29 root_obj.num_contained_objects()?
30 );
31
32 Ok(())
33}Sourcepub fn is_connected_to_sc_provider(&self) -> Result<bool, Error>
pub fn is_connected_to_sc_provider(&self) -> Result<bool, Error>
Whether this workspace is connected to a source code control provider
(WorkspaceFile.IsConnectedToSCProvider).
Connection is a side effect of the engine adopting the workspace, not
something this type performs, so a freshly opened file can report
false until the engine takes it as the current workspace.
§Errors
Error if the COM call fails or returns an unexpected type.
Sourcepub fn save_workspace_and_project_files(
&self,
options: i32,
) -> Result<bool, Error>
pub fn save_workspace_and_project_files( &self, options: i32, ) -> Result<bool, Error>
Writes the workspace and its projects to disk if they have been modified
(WorkspaceFile.SaveWorkspaceAndProjectFiles).
This method can raise a dialog and is therefore unsafe on an
unattended host. When there are modifications it asks the user before
writing, and a false return means precisely that they declined, not
that the save failed. Nothing is prompted or written when nothing has
changed. A failure to write is reported as an error naming the files,
not as false.
Engine-level dialog suppression does not cover this one; it is a
deliberate confirmation, not a configurable prompt. Guard the call with a
Watchdog if a service must make it at all.
§Errors
Error if the COM call fails or any file cannot be written.