pub struct ScanPropsBuilder {
pub continuous_scan: Option<bool>,
pub bouncy_scan: Option<bool>,
pub autosave: Option<AutosaveMode>,
pub series_name: Option<String>,
pub comment: Option<String>,
pub modules_names: Option<Vec<String>>,
pub autopaste: Option<AutopasteMode>,
}Expand description
Builder for setting scan properties.
Use None for fields that should not be changed.
Fields§
§continuous_scan: Option<bool>Continuous scan: None = no change, Some(true) = On, Some(false) = Off
bouncy_scan: Option<bool>Bouncy scan: None = no change, Some(true) = On, Some(false) = Off
autosave: Option<AutosaveMode>Autosave mode: None = no change
series_name: Option<String>Base name for saved images: None = no change
comment: Option<String>Comment saved in file: None = no change
modules_names: Option<Vec<String>>Module names whose parameters are saved in image header: None = no change
autopaste: Option<AutopasteMode>Autopaste mode: None = no change
Implementations§
Source§impl ScanPropsBuilder
impl ScanPropsBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder with all fields set to None (no changes)
Examples found in repository?
examples/scan_props.rs (line 24)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6 let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8 println!("=== Scan Properties Test ===\n");
9
10 // Step 1: Read current properties
11 println!("1. Reading current scan properties...");
12 let props_before = client.scan_props_get()?;
13 println!(" Continuous scan: {}", props_before.continuous_scan);
14 println!(" Bouncy scan: {}", props_before.bouncy_scan);
15 println!(" Autosave: {:?}", props_before.autosave);
16 println!(" Series name: {:?}", props_before.series_name);
17 println!(" Comment: {:?}", props_before.comment);
18 println!(" Modules: {:?}", props_before.modules_names);
19 println!(" Autopaste: {:?}", props_before.autopaste);
20 println!();
21
22 // Step 2: Modify properties using builder
23 println!("2. Setting new scan properties...");
24 let new_props = ScanPropsBuilder::new()
25 .continuous_scan(true) // Enable continuous scan
26 .bouncy_scan(true) // Enable bouncy scan
27 .autosave(AutosaveMode::Off); // Disable autosave
28
29 client.scan_props_set(new_props)?;
30 println!(" Properties set successfully");
31 println!();
32
33 // Step 3: Read properties again to verify
34 println!("3. Reading properties again to verify changes...");
35 let props_after = client.scan_props_get()?;
36 println!(" Continuous scan: {}", props_after.continuous_scan);
37 println!(" Bouncy scan: {}", props_after.bouncy_scan);
38 println!(" Autosave: {:?}", props_after.autosave);
39 println!(" Series name: {:?}", props_after.series_name);
40 println!(" Comment: {:?}", props_after.comment);
41 println!(" Modules: {:?}", props_after.modules_names);
42 println!(" Autopaste: {:?}", props_after.autopaste);
43 println!();
44
45 // Step 4: Verify changes
46 println!("4. Verifying changes...");
47 let mut success = true;
48
49 if !props_after.continuous_scan {
50 println!(" ✗ Continuous scan not set correctly");
51 success = false;
52 } else {
53 println!(" ✓ Continuous scan set to On");
54 }
55
56 if !props_after.bouncy_scan {
57 println!(" ✗ Bouncy scan not set correctly");
58 success = false;
59 } else {
60 println!(" ✓ Bouncy scan set to On");
61 }
62
63 if props_after.autosave != AutosaveMode::Off {
64 println!(" ✗ Autosave not set correctly");
65 success = false;
66 } else {
67 println!(" ✓ Autosave set to Off");
68 }
69
70 println!();
71 if success {
72 println!("✓ All properties changed successfully!");
73 } else {
74 println!("✗ Some properties did not change as expected");
75 }
76
77 // Step 5: Restore original properties
78 println!("\n5. Restoring original properties...");
79 let restore = ScanPropsBuilder::new()
80 .continuous_scan(props_before.continuous_scan)
81 .bouncy_scan(props_before.bouncy_scan)
82 .autosave(props_before.autosave);
83 client.scan_props_set(restore)?;
84 println!(" Properties restored");
85
86 Ok(())
87}Sourcepub fn continuous_scan(self, value: bool) -> Self
pub fn continuous_scan(self, value: bool) -> Self
Set continuous scan mode
Examples found in repository?
examples/scan_props.rs (line 25)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6 let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8 println!("=== Scan Properties Test ===\n");
9
10 // Step 1: Read current properties
11 println!("1. Reading current scan properties...");
12 let props_before = client.scan_props_get()?;
13 println!(" Continuous scan: {}", props_before.continuous_scan);
14 println!(" Bouncy scan: {}", props_before.bouncy_scan);
15 println!(" Autosave: {:?}", props_before.autosave);
16 println!(" Series name: {:?}", props_before.series_name);
17 println!(" Comment: {:?}", props_before.comment);
18 println!(" Modules: {:?}", props_before.modules_names);
19 println!(" Autopaste: {:?}", props_before.autopaste);
20 println!();
21
22 // Step 2: Modify properties using builder
23 println!("2. Setting new scan properties...");
24 let new_props = ScanPropsBuilder::new()
25 .continuous_scan(true) // Enable continuous scan
26 .bouncy_scan(true) // Enable bouncy scan
27 .autosave(AutosaveMode::Off); // Disable autosave
28
29 client.scan_props_set(new_props)?;
30 println!(" Properties set successfully");
31 println!();
32
33 // Step 3: Read properties again to verify
34 println!("3. Reading properties again to verify changes...");
35 let props_after = client.scan_props_get()?;
36 println!(" Continuous scan: {}", props_after.continuous_scan);
37 println!(" Bouncy scan: {}", props_after.bouncy_scan);
38 println!(" Autosave: {:?}", props_after.autosave);
39 println!(" Series name: {:?}", props_after.series_name);
40 println!(" Comment: {:?}", props_after.comment);
41 println!(" Modules: {:?}", props_after.modules_names);
42 println!(" Autopaste: {:?}", props_after.autopaste);
43 println!();
44
45 // Step 4: Verify changes
46 println!("4. Verifying changes...");
47 let mut success = true;
48
49 if !props_after.continuous_scan {
50 println!(" ✗ Continuous scan not set correctly");
51 success = false;
52 } else {
53 println!(" ✓ Continuous scan set to On");
54 }
55
56 if !props_after.bouncy_scan {
57 println!(" ✗ Bouncy scan not set correctly");
58 success = false;
59 } else {
60 println!(" ✓ Bouncy scan set to On");
61 }
62
63 if props_after.autosave != AutosaveMode::Off {
64 println!(" ✗ Autosave not set correctly");
65 success = false;
66 } else {
67 println!(" ✓ Autosave set to Off");
68 }
69
70 println!();
71 if success {
72 println!("✓ All properties changed successfully!");
73 } else {
74 println!("✗ Some properties did not change as expected");
75 }
76
77 // Step 5: Restore original properties
78 println!("\n5. Restoring original properties...");
79 let restore = ScanPropsBuilder::new()
80 .continuous_scan(props_before.continuous_scan)
81 .bouncy_scan(props_before.bouncy_scan)
82 .autosave(props_before.autosave);
83 client.scan_props_set(restore)?;
84 println!(" Properties restored");
85
86 Ok(())
87}Sourcepub fn bouncy_scan(self, value: bool) -> Self
pub fn bouncy_scan(self, value: bool) -> Self
Set bouncy scan mode
Examples found in repository?
examples/scan_props.rs (line 26)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6 let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8 println!("=== Scan Properties Test ===\n");
9
10 // Step 1: Read current properties
11 println!("1. Reading current scan properties...");
12 let props_before = client.scan_props_get()?;
13 println!(" Continuous scan: {}", props_before.continuous_scan);
14 println!(" Bouncy scan: {}", props_before.bouncy_scan);
15 println!(" Autosave: {:?}", props_before.autosave);
16 println!(" Series name: {:?}", props_before.series_name);
17 println!(" Comment: {:?}", props_before.comment);
18 println!(" Modules: {:?}", props_before.modules_names);
19 println!(" Autopaste: {:?}", props_before.autopaste);
20 println!();
21
22 // Step 2: Modify properties using builder
23 println!("2. Setting new scan properties...");
24 let new_props = ScanPropsBuilder::new()
25 .continuous_scan(true) // Enable continuous scan
26 .bouncy_scan(true) // Enable bouncy scan
27 .autosave(AutosaveMode::Off); // Disable autosave
28
29 client.scan_props_set(new_props)?;
30 println!(" Properties set successfully");
31 println!();
32
33 // Step 3: Read properties again to verify
34 println!("3. Reading properties again to verify changes...");
35 let props_after = client.scan_props_get()?;
36 println!(" Continuous scan: {}", props_after.continuous_scan);
37 println!(" Bouncy scan: {}", props_after.bouncy_scan);
38 println!(" Autosave: {:?}", props_after.autosave);
39 println!(" Series name: {:?}", props_after.series_name);
40 println!(" Comment: {:?}", props_after.comment);
41 println!(" Modules: {:?}", props_after.modules_names);
42 println!(" Autopaste: {:?}", props_after.autopaste);
43 println!();
44
45 // Step 4: Verify changes
46 println!("4. Verifying changes...");
47 let mut success = true;
48
49 if !props_after.continuous_scan {
50 println!(" ✗ Continuous scan not set correctly");
51 success = false;
52 } else {
53 println!(" ✓ Continuous scan set to On");
54 }
55
56 if !props_after.bouncy_scan {
57 println!(" ✗ Bouncy scan not set correctly");
58 success = false;
59 } else {
60 println!(" ✓ Bouncy scan set to On");
61 }
62
63 if props_after.autosave != AutosaveMode::Off {
64 println!(" ✗ Autosave not set correctly");
65 success = false;
66 } else {
67 println!(" ✓ Autosave set to Off");
68 }
69
70 println!();
71 if success {
72 println!("✓ All properties changed successfully!");
73 } else {
74 println!("✗ Some properties did not change as expected");
75 }
76
77 // Step 5: Restore original properties
78 println!("\n5. Restoring original properties...");
79 let restore = ScanPropsBuilder::new()
80 .continuous_scan(props_before.continuous_scan)
81 .bouncy_scan(props_before.bouncy_scan)
82 .autosave(props_before.autosave);
83 client.scan_props_set(restore)?;
84 println!(" Properties restored");
85
86 Ok(())
87}Sourcepub fn autosave(self, mode: AutosaveMode) -> Self
pub fn autosave(self, mode: AutosaveMode) -> Self
Set autosave mode
Examples found in repository?
examples/scan_props.rs (line 27)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5
6 let mut client = NanonisClient::new("127.0.0.1", 6501)?;
7
8 println!("=== Scan Properties Test ===\n");
9
10 // Step 1: Read current properties
11 println!("1. Reading current scan properties...");
12 let props_before = client.scan_props_get()?;
13 println!(" Continuous scan: {}", props_before.continuous_scan);
14 println!(" Bouncy scan: {}", props_before.bouncy_scan);
15 println!(" Autosave: {:?}", props_before.autosave);
16 println!(" Series name: {:?}", props_before.series_name);
17 println!(" Comment: {:?}", props_before.comment);
18 println!(" Modules: {:?}", props_before.modules_names);
19 println!(" Autopaste: {:?}", props_before.autopaste);
20 println!();
21
22 // Step 2: Modify properties using builder
23 println!("2. Setting new scan properties...");
24 let new_props = ScanPropsBuilder::new()
25 .continuous_scan(true) // Enable continuous scan
26 .bouncy_scan(true) // Enable bouncy scan
27 .autosave(AutosaveMode::Off); // Disable autosave
28
29 client.scan_props_set(new_props)?;
30 println!(" Properties set successfully");
31 println!();
32
33 // Step 3: Read properties again to verify
34 println!("3. Reading properties again to verify changes...");
35 let props_after = client.scan_props_get()?;
36 println!(" Continuous scan: {}", props_after.continuous_scan);
37 println!(" Bouncy scan: {}", props_after.bouncy_scan);
38 println!(" Autosave: {:?}", props_after.autosave);
39 println!(" Series name: {:?}", props_after.series_name);
40 println!(" Comment: {:?}", props_after.comment);
41 println!(" Modules: {:?}", props_after.modules_names);
42 println!(" Autopaste: {:?}", props_after.autopaste);
43 println!();
44
45 // Step 4: Verify changes
46 println!("4. Verifying changes...");
47 let mut success = true;
48
49 if !props_after.continuous_scan {
50 println!(" ✗ Continuous scan not set correctly");
51 success = false;
52 } else {
53 println!(" ✓ Continuous scan set to On");
54 }
55
56 if !props_after.bouncy_scan {
57 println!(" ✗ Bouncy scan not set correctly");
58 success = false;
59 } else {
60 println!(" ✓ Bouncy scan set to On");
61 }
62
63 if props_after.autosave != AutosaveMode::Off {
64 println!(" ✗ Autosave not set correctly");
65 success = false;
66 } else {
67 println!(" ✓ Autosave set to Off");
68 }
69
70 println!();
71 if success {
72 println!("✓ All properties changed successfully!");
73 } else {
74 println!("✗ Some properties did not change as expected");
75 }
76
77 // Step 5: Restore original properties
78 println!("\n5. Restoring original properties...");
79 let restore = ScanPropsBuilder::new()
80 .continuous_scan(props_before.continuous_scan)
81 .bouncy_scan(props_before.bouncy_scan)
82 .autosave(props_before.autosave);
83 client.scan_props_set(restore)?;
84 println!(" Properties restored");
85
86 Ok(())
87}Sourcepub fn series_name(self, name: impl Into<String>) -> Self
pub fn series_name(self, name: impl Into<String>) -> Self
Set series name
Sourcepub fn modules_names(self, names: Vec<String>) -> Self
pub fn modules_names(self, names: Vec<String>) -> Self
Set modules names
Sourcepub fn autopaste(self, mode: AutopasteMode) -> Self
pub fn autopaste(self, mode: AutopasteMode) -> Self
Set autopaste mode
Trait Implementations§
Source§impl Clone for ScanPropsBuilder
impl Clone for ScanPropsBuilder
Source§fn clone(&self) -> ScanPropsBuilder
fn clone(&self) -> ScanPropsBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScanPropsBuilder
impl Debug for ScanPropsBuilder
Source§impl Default for ScanPropsBuilder
impl Default for ScanPropsBuilder
Source§fn default() -> ScanPropsBuilder
fn default() -> ScanPropsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ScanPropsBuilder
impl RefUnwindSafe for ScanPropsBuilder
impl Send for ScanPropsBuilder
impl Sync for ScanPropsBuilder
impl Unpin for ScanPropsBuilder
impl UnwindSafe for ScanPropsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more