[−][src]Struct memflow::connector::args::ConnectorArgs
Argument wrapper for connectors
Examples
Construct from a string:
use memflow::connector::ConnectorArgs; use std::convert::TryFrom; let argstr = "opt1=test1,opt2=test2,opt3=test3"; let args = ConnectorArgs::parse(argstr).unwrap();
Construct as builder:
use memflow::connector::ConnectorArgs; let args = ConnectorArgs::new() .insert("arg1", "test1") .insert("arg2", "test2");
Implementations
impl ConnectorArgs
[src]
pub fn new() -> Self
[src]
Creates an empty ConnectorArgs
struct.
pub fn with_default(value: &str) -> Self
[src]
Creates a ConnectorArgs
struct with a default (unnamed) value.
pub fn parse(args: &str) -> Result<Self>
[src]
Tries to create a ConnectorArgs
structure from an argument string.
The argument string is a string of comma seperated key-value pairs.
An argument string can just contain keys and values:
opt1=val1,opt2=val2,opt3=val3
The argument string can also contain a default value as the first entry
which will be placed as a default argument:
default_value,opt1=val1,opt2=val2
This function can be used to initialize a connector from user input.
pub fn insert(self, key: &str, value: &str) -> Self
[src]
Consumes self, inserts the given key-value pair and returns the self again.
This function can be used as a builder pattern when programatically configuring connectors.
Examples
use memflow::connector::ConnectorArgs; let args = ConnectorArgs::new() .insert("arg1", "test1") .insert("arg2", "test2");
pub fn get(&self, key: &str) -> Option<&String>
[src]
Tries to retrieve an entry from the options map.
If the entry was not found this function returns a None
value.
pub fn get_default(&self) -> Option<&String>
[src]
Tries to retrieve the default entry from the options map.
If the entry was not found this function returns a None
value.
This function is a convenience wrapper for args.get("default")
.
Trait Implementations
impl Clone for ConnectorArgs
[src]
fn clone(&self) -> ConnectorArgs
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ConnectorArgs
[src]
impl Default for ConnectorArgs
[src]
impl<'_> TryFrom<&'_ str> for ConnectorArgs
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(args: &str) -> Result<Self>
[src]
impl TryFrom<String> for ConnectorArgs
[src]
Auto Trait Implementations
impl RefUnwindSafe for ConnectorArgs
impl Send for ConnectorArgs
impl Sync for ConnectorArgs
impl Unpin for ConnectorArgs
impl UnwindSafe for ConnectorArgs
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,