Skip to main content

WorkspaceObject

Struct WorkspaceObject 

Source
pub struct WorkspaceObject { /* private fields */ }
Expand description

Safe wrapper for TestStand™ WorkspaceObject (IWorkspaceObject).

Implementations§

Source§

impl WorkspaceObject

Source

pub fn display_name(&self) -> Result<String, Error>

Reads display name (WorkspaceObject.DisplayName).

§Errors

Error if the COM call fails or returns an unexpected type.

Examples found in repository?
examples/workspace_create.rs (line 13)
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}
Source

pub fn set_display_name(&self, value: &str) -> Result<(), Error>

Writes display name (WorkspaceObject.DisplayName).

§Errors

Error if the COM call fails.

Source

pub fn path(&self) -> Result<String, Error>

Reads relative path (WorkspaceObject.Path).

§Errors

Error if the COM call fails or returns an unexpected type.

Source

pub fn set_path(&self, value: &str) -> Result<(), Error>

Writes relative path (WorkspaceObject.Path).

§Errors

Error if the COM call fails.

Source

pub fn file_exists(&self) -> Result<bool, Error>

Reads file exists status (WorkspaceObject.FileExists).

§Errors

Error if the COM call fails or returns an unexpected type.

Source

pub fn object_type(&self) -> Result<i32, Error>

Reads object type discriminant (WorkspaceObject.ObjectType).

§Errors

Error if the COM call fails or returns an unexpected type.

Examples found in repository?
examples/workspace_create.rs (line 14)
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}
Source

pub fn num_contained_objects(&self) -> Result<i32, Error>

Reads number of contained child objects (WorkspaceObject.NumContainedObjects).

§Errors

Error if the COM call fails or returns an unexpected type.

Examples found in repository?
examples/workspace_create.rs (line 15)
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}
Source

pub fn get_contained_object(&self, index: i32) -> Result<Self, Error>

Retrieves a contained child object by 0-based index (WorkspaceObject.GetContainedObject).

§Errors

Error if the COM call fails or returns an unexpected type.

Source

pub fn get_absolute_path(&self) -> Result<String, Error>

Reads absolute file path (WorkspaceObject.GetAbsolutePath).

§Errors

Error if the COM call fails or returns an unexpected type.

Source

pub fn new_file(&self, path_string: &str) -> Result<Self, Error>

Creates a new child file object (WorkspaceObject.NewFile).

§Errors

Error if the COM call fails or returns an unexpected type.

Examples found in repository?
examples/workspace_create.rs (line 21)
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}
Source

pub fn new_folder(&self, folder_name: &str) -> Result<Self, Error>

Creates a new child folder object (WorkspaceObject.NewFolder).

§Errors

Error if the COM call fails or returns an unexpected type.

Examples found in repository?
examples/workspace_create.rs (line 18)
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}
Source

pub fn remove_object(&self, index: i32) -> Result<Self, Error>

Removes a child object by index (WorkspaceObject.RemoveObject).

§Errors

Error if the COM call fails or returns an unexpected type.

Trait Implementations§

Source§

impl Debug for WorkspaceObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.