Skip to main content

ScanPropsBuilder

Struct ScanPropsBuilder 

Source
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

Source

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}
Source

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}
Source

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}
Source

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}
Source

pub fn series_name(self, name: impl Into<String>) -> Self

Set series name

Source

pub fn comment(self, comment: impl Into<String>) -> Self

Set comment

Source

pub fn modules_names(self, names: Vec<String>) -> Self

Set modules names

Source

pub fn autopaste(self, mode: AutopasteMode) -> Self

Set autopaste mode

Trait Implementations§

Source§

impl Clone for ScanPropsBuilder

Source§

fn clone(&self) -> ScanPropsBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScanPropsBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ScanPropsBuilder

Source§

fn default() -> ScanPropsBuilder

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.