Backend

Enum Backend 

Source
pub enum Backend<'a> {
    Default,
    Xml(&'a str),
    XmlMem(&'a str),
    Network(&'a str),
    Usb(&'a str),
    Serial(&'a str),
    Uri(&'a str),
    Local,
}
Expand description

Backends for I/O Contexts.

An I/O Context relies on a backend that provides sensor data.

Variants§

§

Default

Use the default backend. This will create a network context if the IIOD_REMOTE environment variable is set to the hostname where the IIOD server runs. If set to an empty string, the server will be discovered using ZeroConf. If the environment variable is not set, a local context will be created instead.

§

Xml(&'a str)

XML Backend, creates a Context from an XML file. Here the string is the name of the file. Example Parameter: “/home/user/file.xml”

§

XmlMem(&'a str)

XML Backend, creates a Context from an in-memory XML string. Here the string is the XML description.

§

Network(&'a str)

Network Backend, creates a Context through a network connection. Requires a hostname, IPv4 or IPv6 address to connect to another host that is running the IIO Daemon. If an empty string is provided, automatic discovery through ZeroConf is performed (if available in IIO). Example Parameter:

  • “192.168.2.1” to connect to given IPv4 host, or
  • “localhost” to connect to localhost running IIOD, or
  • “plutosdr.local” to connect to host with given hostname, or
  • “” for automatic discovery
§

Usb(&'a str)

USB Backend, creates a context through a USB connection. If only a single USB device is attached, provide an empty String (“”) to use that. When more than one usb device is attached, requires bus, address, and interface parts separated with a dot. Example Parameter: “3.32.5”

§

Serial(&'a str)

Serial Backend, creates a context through a serial connection. Requires (Values in parentheses show examples):

  • a port (/dev/ttyUSB0),
  • baud_rate (default 115200)
  • serial port configuration
    • data bits (5 6 7 8 9)
    • parity (‘n’ none, ‘o’ odd, ‘e’ even, ‘m’ mark, ‘s’ space)
    • stop bits (1 2)
    • flow control (‘\0’ none, ‘x’ Xon Xoff, ‘r’ RTSCTS, ‘d’ DTRDSR)

Example Parameters:

  • “/dev/ttyUSB0,115200”, or
  • “/dev/ttyUSB0,115200,8n1”
§

Uri(&'a str)

“Guess” the backend to use from the URI that’s supplied. This merely provides compatibility with iio_create_context_from_uri from the underlying IIO C-library. Refer to the IIO docs for information on how to format this parameter.

§

Local

Local Backend, only available on Linux hosts. Sensors to work with are part of the system and accessible in sysfs (under /sys/...).

Trait Implementations§

Source§

impl<'a> Debug for Backend<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Backend<'a>

§

impl<'a> RefUnwindSafe for Backend<'a>

§

impl<'a> Send for Backend<'a>

§

impl<'a> Sync for Backend<'a>

§

impl<'a> Unpin for Backend<'a>

§

impl<'a> UnwindSafe for Backend<'a>

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.