pub struct NanonisClientBuilder { /* private fields */ }Expand description
Builder for constructing NanonisClient instances with flexible configuration.
The builder pattern allows you to configure various aspects of the client before establishing the connection. This is more ergonomic than having multiple constructor variants.
§Examples
Basic usage:
use nanonis_rs::NanonisClient;
let client = NanonisClient::builder()
.address("127.0.0.1")
.port(6501)
.debug(true)
.build()?;With custom timeouts:
use std::time::Duration;
use nanonis_rs::NanonisClient;
let client = NanonisClient::builder()
.address("192.168.1.100")
.port(6501)
.connect_timeout(Duration::from_secs(30))
.read_timeout(Duration::from_secs(60))
.debug(false)
.build()?;Implementations§
Source§impl NanonisClientBuilder
impl NanonisClientBuilder
pub fn address(self, addr: &str) -> NanonisClientBuilder
pub fn port(self, port: u16) -> NanonisClientBuilder
Sourcepub fn debug(self, debug: bool) -> NanonisClientBuilder
pub fn debug(self, debug: bool) -> NanonisClientBuilder
Enable or disable debug logging
Sourcepub fn config(self, config: ConnectionConfig) -> NanonisClientBuilder
pub fn config(self, config: ConnectionConfig) -> NanonisClientBuilder
Set the full connection configuration
Sourcepub fn connect_timeout(self, timeout: Duration) -> NanonisClientBuilder
pub fn connect_timeout(self, timeout: Duration) -> NanonisClientBuilder
Set connect timeout
Sourcepub fn read_timeout(self, timeout: Duration) -> NanonisClientBuilder
pub fn read_timeout(self, timeout: Duration) -> NanonisClientBuilder
Set read timeout
Sourcepub fn write_timeout(self, timeout: Duration) -> NanonisClientBuilder
pub fn write_timeout(self, timeout: Duration) -> NanonisClientBuilder
Set write timeout
Sourcepub fn safe_tip_on_drop(self, enabled: bool) -> NanonisClientBuilder
pub fn safe_tip_on_drop(self, enabled: bool) -> NanonisClientBuilder
Enable automatic tip safety on client drop.
When enabled, the client will automatically withdraw the Z-controller and move motors to a safe position when dropped. This is a safety feature to protect the tip if the program exits unexpectedly.
Warning: This will move hardware on every client drop, including normal program termination. Only enable if you want this behavior.
Default: false (disabled)
Sourcepub fn build(self) -> Result<NanonisClient, NanonisError>
pub fn build(self) -> Result<NanonisClient, NanonisError>
Build the NanonisClient