pub struct ConnectionOptions { /* private fields */ }Expand description
Connection-specific configuration options that can override base host settings.
This struct defines optional connection parameters that can be specified per connection plugin name (e.g., “ssh”, “netconf”, “http”) to override the base connection settings defined at the host, group, or defaults level. Connection options are stored in a map keyed by connection plugin name and are applied during connection parameter resolution.
All fields are optional, allowing partial overrides. When resolving connection parameters, these options take precedence over base settings at the same hierarchy level (host, group, or defaults).
§Fields
-
hostname- Optional hostname or IP address override for this connection plugin name. When specified, overrides the base hostname for connections of this type. -
port- Optional port number override for this connection plugin name. When specified, overrides the base port for connections of this type. -
username- Optional username override for authentication. When specified, overrides the base username for connections of this type. -
password- Optional password override for authentication. When specified, overrides the base password for connections of this type. -
platform- Optional platform identifier override. When specified, overrides the base platform for connections of this type. -
extras- Optional arbitrary JSON data for connection-specific configuration. Allows storing additional connection parameters that don’t fit the standard fields.
§Examples
let options = ConnectionOptions::builder()
.port(830)
.username("netconf_user")
.build();Implementations§
Source§impl ConnectionOptions
impl ConnectionOptions
pub fn builder() -> ConnectionOptionsBuilder
pub fn hostname(&self) -> Option<&str>
pub fn port(&self) -> Option<u16>
pub fn username(&self) -> Option<&str>
pub fn password(&self) -> Option<&str>
pub fn platform(&self) -> Option<&str>
pub fn extras(&self) -> Option<&Extras>
Sourcepub fn to_builder(&self) -> ConnectionOptionsBuilder
pub fn to_builder(&self) -> ConnectionOptionsBuilder
Converts this ConnectionOptions instance into a builder for modification.
This method creates a new ConnectionOptionsBuilder initialized with all the current
values from this ConnectionOptions instance. This is useful when you need to create
a modified copy of existing connection options while preserving most of the original
configuration.
§Returns
Returns a ConnectionOptionsBuilder with all fields initialized to match the current
ConnectionOptions instance. The builder can then be used to modify specific fields
before calling build() to create a new ConnectionOptions instance.
§Examples
let options = ConnectionOptions::builder()
.port(830)
.username("netconf_user")
.build();
let modified = options.to_builder()
.port(831)
.build();
assert_eq!(modified.port(), Some(831));Trait Implementations§
Source§impl Clone for ConnectionOptions
impl Clone for ConnectionOptions
Source§fn clone(&self) -> ConnectionOptions
fn clone(&self) -> ConnectionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionOptions
impl Debug for ConnectionOptions
Source§impl Default for ConnectionOptions
impl Default for ConnectionOptions
Source§impl<'de> Deserialize<'de> for ConnectionOptions
impl<'de> Deserialize<'de> for ConnectionOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ConnectionOptions
impl JsonSchema for ConnectionOptions
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ConnectionOptions
impl PartialEq for ConnectionOptions
Source§fn eq(&self, other: &ConnectionOptions) -> bool
fn eq(&self, other: &ConnectionOptions) -> bool
self and other values to be equal, and is used by ==.