Skip to main content

ConnectionOptionsBuilder

Struct ConnectionOptionsBuilder 

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

Builder for constructing ConnectionOptions instances.

This builder provides a fluent interface for creating connection options with optional field overrides. All fields start as None and can be set individually before calling build() to create the final ConnectionOptions instance.

The builder is typically created via ConnectionOptions::builder() or by converting an existing ConnectionOptions instance using to_builder().

§Fields

  • hostname - Optional hostname or IP address override for the connection plugin name. When set, this value will override the base hostname for connections of this type.

  • port - Optional port number override for the connection plugin name. When set, this value will override the base port for connections of this type.

  • username - Optional username override for authentication. When set, this value will override the base username for connections of this type.

  • password - Optional password override for authentication. When set, this value will override the base password for connections of this type.

  • platform - Optional platform identifier override. When set, this value will override 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()
    .hostname("10.0.0.1")
    .port(830)
    .username("netconf_user")
    .build();

assert_eq!(options.hostname(), Some("10.0.0.1"));
assert_eq!(options.port(), Some(830));

Implementations§

Source§

impl ConnectionOptionsBuilder

Source

pub fn new() -> Self

Source

pub fn hostname<S>(self, hostname: S) -> Self
where S: Into<String>,

Source

pub fn port(self, port: u16) -> Self

Source

pub fn username<S>(self, username: S) -> Self
where S: Into<String>,

Source

pub fn password<S>(self, password: S) -> Self
where S: Into<String>,

Source

pub fn platform<S>(self, platform: S) -> Self
where S: Into<String>,

Source

pub fn extras(self, extras: Extras) -> Self

Source

pub fn build(self) -> ConnectionOptions

Trait Implementations§

Source§

impl Default for ConnectionOptionsBuilder

Source§

fn default() -> Self

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> 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.