Struct soapysdr::Args

source ·
pub struct Args(_);
Expand description

A list of key=value pairs.

Implementations§

source§

impl Args

source

pub fn new() -> Args

Create a new, empty Args list

source

pub unsafe fn from_raw(a: SoapySDRKwargs) -> Args

Safety

Be careful that SoapySDRKwargs is either:

source

pub fn as_raw(&mut self) -> *mut SoapySDRKwargs

source

pub fn as_raw_const(&self) -> *const SoapySDRKwargs

source

pub fn set<K: Into<Vec<u8>>, V: Into<Vec<u8>>>(&mut self, key: K, value: V)

Append a key-value pair to the arguments list

Example
use soapysdr::Args;
let mut args = Args::new();
args.set("driver", "lime");
Panics
  • if key or value contain null bytes
source

pub fn get<'a>(&'a self, key: &str) -> Option<&'a str>

Get the value corresponding to a key in the arguments list.

Example:
use soapysdr::Args;
let args: Args = "serial=123456".into();
assert_eq!(args.get("serial"), Some("123456"));
source

pub fn iter(&self) -> ArgsIterator<'_>

Get an iterator over the (key, value) pairs in the arguments list.

Example:
use soapysdr::Args;
let args: Args = "driver=lime, serial=123456".into();
let mut i = args.iter();
assert_eq!(i.next(), Some(("driver", "lime")));
assert_eq!(i.next(), Some(("serial", "123456")));
assert_eq!(i.next(), None);

Trait Implementations§

source§

impl Default for Args

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for Args

source§

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

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

impl Drop for Args

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, K, V> From<&'a [(K, V)]> for Argswhere &'a K: Into<Vec<u8>>, &'a V: Into<Vec<u8>>,

source§

fn from(m: &'a [(K, V)]) -> Args

Converts to this type from the input type.
source§

impl<'a> From<&'a Args> for HashMap<String, String>

source§

fn from(a: &'a Args) -> HashMap<String, String>

Converts to this type from the input type.
source§

impl<'a> From<&'a Args> for String

source§

fn from(a: &'a Args) -> String

Converts to this type from the input type.
source§

impl<'a, K: Eq + Hash, V> From<&'a HashMap<K, V, RandomState>> for Argswhere &'a K: Into<Vec<u8>>, &'a V: Into<Vec<u8>>,

source§

fn from(m: &'a HashMap<K, V>) -> Args

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for Args

source§

fn from(s: &'a str) -> Args

Converts to this type from the input type.
source§

impl From<()> for Args

source§

fn from(_: ()) -> Args

Converts to this type from the input type.
source§

impl<K: Into<Vec<u8>>, V: Into<Vec<u8>>> FromIterator<(K, V)> for Args

source§

fn from_iter<T>(i: T) -> Selfwhere T: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
source§

impl<'a> IntoIterator for &'a Args

§

type Item = (&'a str, &'a str)

The type of the elements being iterated over.
§

type IntoIter = ArgsIterator<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Args

§

impl !Send for Args

§

impl !Sync for Args

§

impl Unpin for Args

§

impl UnwindSafe for Args

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.