Skip to main content

Reader

Struct Reader 

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

Reads a device through a client with credentials.

Implementations§

Source§

impl Reader

Source

pub async fn new(client: Client) -> Result<Self, Error>

Reads the device description.

§Errors

The errors of reading the device description.

Source

pub async fn read( &mut self, reference: &str, name: &str, arguments: &[(&str, &str)], ) -> Result<Values, Error>

Calls an action that only reads, and returns its output with secrets hidden.

§Errors

The errors of finding the service and the action, of generic::check, and of the call.

Source

pub async fn document( &mut self, reference: &str, name: &str, output: &str, ) -> Result<Option<String>, Error>

Fetches a document whose path an action without inputs returns, like the host list at the path X_AVM-DE_GetHostListPath returns in NewX_AVM-DE_HostListPath. The path holds a session ID, which never leaves this function. None if the device has no such action, or answers it with a fault or without a path, like try_read.

§Errors

The other errors of the call, and the errors of fetching the document.

Source

pub async fn document_with( &mut self, reference: &str, __arg2: (&str, &[(&str, &str)]), output: &str, query: &str, ) -> Result<Option<String>, Error>

Like document, for an action with inputs, like GetPhonebook with NewPhonebookID, and with query added to the query of the path, like max=10. An action can return a full URL, like the call list on the address of the device; only its path and query are fetched, from the device of this reader.

§Errors

The errors of document.

Source

pub async fn try_read( &mut self, reference: &str, name: &str, arguments: &[(&str, &str)], ) -> Result<Option<Values>, Error>

Like read, but None if the device has no such service or action, or answers with a fault, like 606 for missing rights.

§Errors

The other errors of read, like failed logins and connections.

Source

pub async fn entries( &mut self, reference: &str, __arg2: (&str, &str), __arg3: (&str, &str), max: u32, ) -> Result<Option<(u32, Vec<Values>)>, Error>

Reads a list the device gives one entry per call: the number of entries from the output count of the action counter, then the entries from getter with each index as its input index, up to max. Stops early at the first index the device has no entry for. Returns the number the device reported and the entries, or None like try_read if it has no such list.

§Errors

The other errors of read.

Source

pub fn description(&self) -> &DeviceDescription

The device description.

Source

pub async fn service( &mut self, reference: &str, ) -> Result<(Service, &Scpd), Error>

A service and its description, which is read once.

§Errors

The errors of finding the service and of reading its description.

Source

pub fn services(&self, name: &str) -> Vec<String>

The short ids of the services whose name is name, like WLANConfiguration1 and WLANConfiguration2, in order.

Trait Implementations§

Source§

impl Debug for Reader

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Reader

§

impl !RefUnwindSafe for Reader

§

impl !UnwindSafe for Reader

§

impl Forget for Reader

§

impl Move for Reader

§

impl Send for Reader

§

impl Sync for Reader

§

impl Unpin for Reader

§

impl UnsafeUnpin for Reader

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more