Skip to main content

DatabaseProxy

Struct DatabaseProxy 

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

Proxy to a database with easy abstraction for commands that request devices.

Implementations§

Source§

impl DatabaseProxy

Source

pub fn new_from_env() -> Self

New handle to the environment database.

Source

pub fn new(host: &str, port: u16) -> Self

New handle to specific host/port.

Source

pub fn new_from_env_with_backend(backend: Arc<dyn Backend>) -> Self

New handle to the environment database, with backend.

Source

pub fn new_with_backend( backend: Arc<dyn Backend>, host: &str, port: u16, ) -> Self

New handle to specific host/port, with backend.

Source

pub async fn database_info_async(&self) -> Result<Spectrum<str>>

Get the description of the database server and of what it holds, line by line.

Source

pub fn database_info(&self) -> Result<Spectrum<str>>

The blocking form of Self::database_info_async.

Source

pub async fn add_dev_async( &self, name: &str, class: &str, server: &str, ) -> Result<()>

Define a device of the given class in a server, named exe/inst.

Source

pub fn add_dev(&self, name: &str, class: &str, server: &str) -> Result<()>

The blocking form of Self::add_dev_async.

Source

pub async fn delete_dev_async(&self, name: &str) -> Result<()>

Delete a device.

Source

pub fn delete_dev(&self, name: &str) -> Result<()>

The blocking form of Self::delete_dev_async.

Source

pub async fn add_server_async( &self, server: &str, devs: &[(&str, &str)], ) -> Result<()>

Define a server, named exe/inst, along with its devices, each given with its class, a device already defined in another server being moved to this one.

Source

pub fn add_server(&self, server: &str, devs: &[(&str, &str)]) -> Result<()>

The blocking form of Self::add_server_async.

Source

pub async fn delete_server_async(&self, server: &str) -> Result<()>

Delete a server, named exe/inst, along with every device of it.

Source

pub fn delete_server(&self, server: &str) -> Result<()>

The blocking form of Self::delete_server_async.

Source

pub async fn rename_server_async( &self, name: &str, new_name: &str, ) -> Result<()>

Rename a server, named exe/inst, its devices following it.

Source

pub fn rename_server(&self, name: &str, new_name: &str) -> Result<()>

The blocking form of Self::rename_server_async.

Source

pub async fn list_server_dev_async( &self, server: &str, ) -> Result<Vec<Named<Scalar<str>>>>

List the devices a server, named exe/inst, should run, the class each device is an instance of being named by that device. This is what a server queries when booting in order to know which devices to create and export.

Source

pub fn list_server_dev(&self, server: &str) -> Result<Vec<Named<Scalar<str>>>>

The blocking form of Self::list_server_dev_async.

Source

pub async fn list_dev_async(&self, filter: &str) -> Result<Spectrum<str>>

List all existing devices, filtering using a filter, using a pattern for matching with domain/family/member pattern, supporting one ‘*’ per member.

Source

pub fn list_dev(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_dev_async.

Source

pub async fn list_dev_member_async(&self, filter: &str) -> Result<Spectrum<str>>

Same as Self::list_dev but returns only the member part of the device names (in domain/family/member).

Source

pub fn list_dev_member(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_dev_member_async.

Source

pub async fn list_dev_family_async(&self, filter: &str) -> Result<Spectrum<str>>

Same as Self::list_dev but returns only the family part of the device names (in domain/family/member).

Source

pub fn list_dev_family(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_dev_family_async.

Source

pub async fn list_dev_domain_async(&self, filter: &str) -> Result<Spectrum<str>>

Same as Self::list_dev but returns only the domain part of the device names (in domain/family/member).

Source

pub fn list_dev_domain(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_dev_domain_async.

Source

pub async fn export_dev_async(&self, info: ExportDevInfo<'_>) -> Result<()>

Mark a device as exported, recording how to reach it.

Source

pub fn export_dev(&self, info: ExportDevInfo<'_>) -> Result<()>

The blocking form of Self::export_dev_async.

Source

pub async fn unexport_dev_async(&self, dev_name: &str) -> Result<()>

Mark a device as no longer exported.

Source

pub fn unexport_dev(&self, dev_name: &str) -> Result<()>

The blocking form of Self::unexport_dev_async.

Source

pub async fn export_server_async( &self, infos: &[ExportDevInfo<'_>], ) -> Result<()>

Mark the devices of a server as exported, see Self::export_dev_async.

Source

pub fn export_server(&self, infos: &[ExportDevInfo<'_>]) -> Result<()>

The blocking form of Self::export_server_async.

Source

pub async fn unexport_server_async(&self, server: &str) -> Result<()>

Mark every device of a server, named exe/inst, as no longer exported.

Source

pub fn unexport_server(&self, server: &str) -> Result<()>

The blocking form of Self::unexport_server_async.

Source

pub async fn list_exported_dev_async( &self, filter: &str, ) -> Result<Spectrum<str>>

Same input as Self::list_dev, but returns only devices that should currently be exported.

Source

pub fn list_exported_dev(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_exported_dev_async.

Source

pub async fn import_dev_async(&self, dev_name: &str) -> Result<ImportDevInfo>

Get how to reach a device, failing with ErrorKind::DevNotFound if not defined.

Source

pub fn import_dev(&self, dev_name: &str) -> Result<ImportDevInfo>

The blocking form of Self::import_dev_async.

Source

pub async fn get_dev_info_async(&self, dev_name: &str) -> Result<DbDevInfo>

Get what the database knows of a device, failing with ErrorKind::DevNotFound if not defined.

Source

pub fn get_dev_info(&self, dev_name: &str) -> Result<DbDevInfo>

The blocking form of Self::get_dev_info_async.

Source

pub async fn get_dev_alias_async( &self, dev_name: &str, ) -> Result<Option<Scalar<str>>>

Get alias for a given device.

Source

pub fn get_dev_alias(&self, dev_name: &str) -> Result<Option<Scalar<str>>>

The blocking form of Self::get_dev_alias_async.

Source

pub async fn resolve_dev_alias_async(&self, alias: &str) -> Result<Scalar<str>>

Resolve a device alias, failing with ErrorKind::AliasNotFound if not found.

Source

pub fn resolve_dev_alias(&self, alias: &str) -> Result<Scalar<str>>

The blocking form of Self::resolve_dev_alias_async.

Source

pub async fn list_dev_aliases_async( &self, filter: &str, ) -> Result<Spectrum<str>>

List all device aliases matching the given filter (using at most one ‘*’).

Source

pub fn list_dev_aliases(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_dev_aliases_async.

Source

pub async fn get_attr_alias_async( &self, attr_name: &str, ) -> Result<Option<Scalar<str>>>

Get alias for a given attribute.

Source

pub fn get_attr_alias(&self, attr_name: &str) -> Result<Option<Scalar<str>>>

The blocking form of Self::get_attr_alias_async.

Source

pub async fn resolve_attr_alias_async(&self, alias: &str) -> Result<Scalar<str>>

Resolve an attribute alias, failing with ErrorKind::AliasNotFound if not found.

Source

pub fn resolve_attr_alias(&self, alias: &str) -> Result<Scalar<str>>

The blocking form of Self::resolve_attr_alias_async.

Source

pub async fn list_attr_aliases_async( &self, filter: &str, ) -> Result<Spectrum<str>>

List all attribute aliases matching the given filter (using at most one ‘*’).

Source

pub fn list_attr_aliases(&self, filter: &str) -> Result<Spectrum<str>>

The blocking form of Self::list_attr_aliases_async.

Source

pub async fn list_free_prop_async( &self, obj_name: &str, filter: &str, ) -> Result<Spectrum<str>>

List the names of the free properties of an object matching the given filter.

Source

pub fn list_free_prop( &self, obj_name: &str, filter: &str, ) -> Result<Spectrum<str>>

The blocking form of Self::list_free_prop_async.

Source

pub async fn list_class_prop_async( &self, obj_name: &str, filter: &str, ) -> Result<Spectrum<str>>

List the names of the properties of a class matching the given filter.

Source

pub fn list_class_prop( &self, obj_name: &str, filter: &str, ) -> Result<Spectrum<str>>

The blocking form of Self::list_class_prop_async.

Source

pub async fn list_dev_prop_async( &self, obj_name: &str, filter: &str, ) -> Result<Spectrum<str>>

List the names of the properties of a device matching the given filter.

Source

pub fn list_dev_prop( &self, obj_name: &str, filter: &str, ) -> Result<Spectrum<str>>

The blocking form of Self::list_dev_prop_async.

Source

pub fn get_free_prop_async<Spec, Names: ToNames>( &self, obj_name: &str, names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: GetPropSpec<Names>,

The properties of that free object, parsed into the shape the given names ask for, see Self::get_dev_prop_async for the accepted signatures.

Source

pub fn get_free_prop<Spec, Names: ToNames>( &self, obj_name: &str, names: Names, ) -> Result<Spec::Output>
where Spec: GetPropSpec<Names>,

The properties of that free object, see Self::get_free_prop_async.

Source

pub fn get_class_prop_async<Spec, Names: ToNames>( &self, class_name: &str, names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: GetPropSpec<Names>,

The properties of that class, parsed into the shape the given names ask for, see Self::get_dev_prop_async for the accepted signatures.

Source

pub fn get_class_prop<Spec, Names: ToNames>( &self, class_name: &str, names: Names, ) -> Result<Spec::Output>
where Spec: GetPropSpec<Names>,

The properties of that class, see Self::get_class_prop_async.

Source

pub fn get_dev_prop_async<Spec, Names: ToNames>( &self, dev_name: &str, names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: GetPropSpec<Names>,

The properties of that device, parsed into the shape the given names ask for. This specification is really flexible and allows various signatures for the function:

  1. get_dev_prop<T>(&str, &str) -> Result<T>
  2. get_dev_prop<T>(&str, &[&str]) -> Result<Vec<Result<T>>>
  3. get_dev_prop<T>(&str, [&str; N]) -> Result<[Result<T>; N]>
  4. get_dev_prop<(A, B, ...)>(&str, (&str, &str, ...)) -> Result<(Result<A>, Result<B>, ...)>
  5. get_dev_prop<Spectrum<str>>(&str, All) -> Result<Vec<Named<Spectrum<str>>>>

Form 2 also takes the names as a Spectrum<str>, owned or borrowed. Every value is parsed with FromProp: a String, a Vec<String>, a Spectrum<str> sharing the reply, a bool or a number. Like for DevProxy::read_attr, the type has to come from a turbofish, as in get_dev_prop::<f64, _>(dev, "speed"), or from the binding the output is assigned to.

A property the database holds nothing for has no value, which the text forms read as empty and the others fail with ErrorKind::InvalidProp. Form 5 gives every property the device has, each with its name, as the raw values it holds.

All the properties are read within a single request. Note that, unlike the many-properties forms, form 1 has no per-property slot in its output and therefore returns that property’s error directly.

Source

pub fn get_dev_prop<Spec, Names: ToNames>( &self, dev_name: &str, names: Names, ) -> Result<Spec::Output>
where Spec: GetPropSpec<Names>,

The properties of that device, see Self::get_dev_prop_async.

Source

pub fn set_free_prop_async<'a, Spec>( &self, obj_name: &'a str, spec: Spec, ) -> impl Future<Output = Result<()>> + Send
where Spec: SetPropSpec<'a>,

Write the given properties of that free object, see Self::set_dev_prop_async for the accepted signatures.

Source

pub fn set_free_prop<'a, Spec>( &self, obj_name: &'a str, spec: Spec, ) -> Result<()>
where Spec: SetPropSpec<'a>,

Write the given properties of that free object, see Self::set_free_prop_async.

Source

pub fn set_class_prop_async<'a, Spec>( &self, class_name: &'a str, spec: Spec, ) -> impl Future<Output = Result<()>> + Send
where Spec: SetPropSpec<'a>,

Write the given properties of that class, see Self::set_dev_prop_async for the accepted signatures.

Source

pub fn set_class_prop<'a, Spec>( &self, class_name: &'a str, spec: Spec, ) -> Result<()>
where Spec: SetPropSpec<'a>,

Write the given properties of that class, see Self::set_class_prop_async.

Source

pub fn set_dev_prop_async<'a, Spec>( &self, dev_name: &'a str, spec: Spec, ) -> impl Future<Output = Result<()>> + Send
where Spec: SetPropSpec<'a>,

Write the given properties of that device, given as pairs of a name and a value. Like for Self::get_dev_prop, this specification is really flexible and allows various signatures for the function:

  1. set_dev_prop(&str, (&str, T)) -> Result<()>
  2. set_dev_prop(&str, [(&str, T); N]) -> Result<()>
  3. set_dev_prop(&str, Vec<(&str, T)>) -> Result<()>
  4. set_dev_prop(&str, ((&str, A), (&str, B), ...)) -> Result<()>

Each value only needs to implement IntoProp, a bool, a number or a string, so the value types are inferred from the specification and never have to be named, form 4 giving each property its own type, as in set_dev_prop(dev, (("speed", 2.5), ("unit", "mm"))).

All the properties are written within a single request, a property that was already there being overwritten.

Source

pub fn set_dev_prop<'a, Spec>( &self, dev_name: &'a str, spec: Spec, ) -> Result<()>
where Spec: SetPropSpec<'a>,

Write the given properties of that device, see Self::set_dev_prop_async.

Source

pub fn delete_free_prop_async<Names: ToNamesNotAll>( &self, obj_name: &str, names: Names, ) -> impl Future<Output = Result<()>> + Send

Delete the given properties of that free object, see Self::delete_dev_prop_async for the accepted signatures.

Source

pub fn delete_free_prop<Names: ToNamesNotAll>( &self, obj_name: &str, names: Names, ) -> Result<()>

Delete the given properties of that free object, see Self::delete_free_prop_async.

Source

pub fn delete_class_prop_async<Names: ToNamesNotAll>( &self, class_name: &str, names: Names, ) -> impl Future<Output = Result<()>> + Send

Delete the given properties of that class, see Self::delete_dev_prop_async for the accepted signatures.

Source

pub fn delete_class_prop<Names: ToNamesNotAll>( &self, class_name: &str, names: Names, ) -> Result<()>

Delete the given properties of that class, see Self::delete_class_prop_async.

Source

pub fn delete_dev_prop_async<Names: ToNamesNotAll>( &self, dev_name: &str, names: Names, ) -> impl Future<Output = Result<()>> + Send

Delete the given properties of that device, which allows various signatures for the function:

  1. delete_dev_prop(&str, &str) -> Result<()>
  2. delete_dev_prop(&str, &[&str]) -> Result<()>
  3. delete_dev_prop(&str, [&str; N]) -> Result<()>
  4. delete_dev_prop(&str, (&str, &str, ...)) -> Result<()>

Form 2 also takes the names as a Spectrum<str>, owned or borrowed. Every name has to be given, All not being accepted, and deleting a property the database holds nothing for is not an error.

Source

pub fn delete_dev_prop<Names: ToNamesNotAll>( &self, dev_name: &str, names: Names, ) -> Result<()>

Delete the given properties of that device, see Self::delete_dev_prop_async.

Source

pub fn get_class_attr_prop_async<Spec, AttrNames, Names>( &self, class_name: &str, attr_names: AttrNames, prop_names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: GetAttrPropSpec<AttrNames, Names>, AttrNames: ToNames, Names: ToNames,

The properties of the given attributes of that class, parsed into the shape the names of the attributes and of the properties ask for, see Self::get_dev_attr_prop_async for the accepted signatures.

Source

pub fn get_class_attr_prop<Spec, AttrNames, Names>( &self, class_name: &str, attr_names: AttrNames, prop_names: Names, ) -> Result<Spec::Output>
where Spec: GetAttrPropSpec<AttrNames, Names>, AttrNames: ToNames, Names: ToNames,

The properties of the given attributes of that class, see Self::get_class_attr_prop_async.

Source

pub fn get_dev_attr_prop_async<Spec, AttrNames, Names>( &self, dev_name: &str, attr_names: AttrNames, prop_names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: GetAttrPropSpec<AttrNames, Names>, AttrNames: ToNames, Names: ToNames,

The properties of the given attributes of that device, or of every attribute of it that has any, parsed into the shape the names of the attributes and of the properties ask for. The names of the properties are given the way they are to Self::get_dev_prop, and give the same output for every attribute, written P below, which the names of the attributes then shape in the same way:

  1. get_dev_attr_prop<T>(&str, &str, Names) -> Result<P>
  2. get_dev_attr_prop<T>(&str, &[&str], Names) -> Result<Vec<Result<P>>>
  3. get_dev_attr_prop<T>(&str, [&str; N], Names) -> Result<[Result<P>; N]>
  4. get_dev_attr_prop<T>(&str, (&str, &str, ...), Names) -> Result<(Result<P>, Result<P>, ...)>
  5. get_dev_attr_prop<T>(&str, All, Names) -> Result<Vec<NamedResult<P>>>

Form 2 also takes the names as a Spectrum<str>, owned or borrowed, and form 5 gives every attribute the device holds any property for, each with its name. For instance:

  • get_dev_attr_prop::<String, _, _>(dev, "Position", "unit") -> Result<String>
  • get_dev_attr_prop::<String, _, _>(dev, ["Position", "Speed"], "unit") -> Result<[Result<String>; 2]>
  • get_dev_attr_prop::<(String, f64), _, _>(dev, "Position", ("label", "__value")) -> Result<(Result<String>, Result<f64>)>
  • get_dev_attr_prop::<Spectrum<str>, _, _>(dev, All, All) -> Result<Vec<NamedResult<Vec<Named<Spectrum<str>>>>>>

All the attributes are read within a single request. Note that form 1 has no per-attribute slot in its output and therefore returns that attribute’s error directly, the same way form 1 of the properties does.

Source

pub fn get_dev_attr_prop<Spec, AttrNames, Names>( &self, dev_name: &str, attr_names: AttrNames, prop_names: Names, ) -> Result<Spec::Output>
where Spec: GetAttrPropSpec<AttrNames, Names>, AttrNames: ToNames, Names: ToNames,

The properties of the given attributes of that device, see Self::get_dev_attr_prop_async.

Source

pub fn set_class_attr_prop_async<'a, Spec>( &self, class_name: &'a str, spec: Spec, ) -> impl Future<Output = Result<()>> + Send
where Spec: SetAttrPropSpec<'a>,

Write the given properties of attributes of that class, see Self::set_dev_attr_prop_async for the accepted signatures.

Source

pub fn set_class_attr_prop<'a, Spec>( &self, class_name: &'a str, spec: Spec, ) -> Result<()>
where Spec: SetAttrPropSpec<'a>,

Write the given properties of attributes of that class, see Self::set_class_attr_prop_async.

Source

pub fn set_dev_attr_prop_async<'a, Spec>( &self, dev_name: &'a str, spec: Spec, ) -> impl Future<Output = Result<()>> + Send
where Spec: SetAttrPropSpec<'a>,

Write the given properties of attributes of that device, each attribute given as a pair of its name and of its properties, the latter in any of the forms Self::set_dev_prop accepts, written S below:

  1. set_dev_attr_prop(&str, (&str, S)) -> Result<()>
  2. set_dev_attr_prop(&str, [(&str, S); N]) -> Result<()>
  3. set_dev_attr_prop(&str, Vec<(&str, S)>) -> Result<()>

Forms 2 and 3 give every attribute the same form of properties. For instance:

  • set_dev_attr_prop(dev, ("Position", ("unit", "mm")))
  • set_dev_attr_prop(dev, ("Position", (("unit", "mm"), ("min_value", -5))))
  • set_dev_attr_prop(dev, [("Position", vec![("label", "Pos")]), ("Speed", vec![("rel_change", "1")])])

All the attributes are written within a single request.

Source

pub fn set_dev_attr_prop<'a, Spec>( &self, dev_name: &'a str, spec: Spec, ) -> Result<()>
where Spec: SetAttrPropSpec<'a>,

Write the given properties of attributes of that device, see Self::set_dev_attr_prop_async.

Source

pub fn delete_class_attr_prop_async<Names: ToNamesNotAll>( &self, class_name: &str, attr_name: &str, names: Names, ) -> impl Future<Output = Result<()>> + Send

Delete the given properties of one attribute of that class, see Self::delete_dev_attr_prop_async for the accepted signatures.

Source

pub fn delete_class_attr_prop<Names: ToNamesNotAll>( &self, class_name: &str, attr_name: &str, names: Names, ) -> Result<()>

Delete the given properties of one attribute of that class, see Self::delete_class_attr_prop_async.

Source

pub fn delete_dev_attr_prop_async<Names: ToNamesNotAll>( &self, dev_name: &str, attr_name: &str, names: Names, ) -> impl Future<Output = Result<()>> + Send

Delete the given properties of one attribute of that device, the names of the properties being given the way they are to Self::delete_dev_prop:

  1. delete_dev_attr_prop(&str, &str, &str) -> Result<()>
  2. delete_dev_attr_prop(&str, &str, &[&str]) -> Result<()>
  3. delete_dev_attr_prop(&str, &str, [&str; N]) -> Result<()>
  4. delete_dev_attr_prop(&str, &str, (&str, &str, ...)) -> Result<()>

Only one attribute is deleted from per request, the database having no command deleting from several at once.

Source

pub fn delete_dev_attr_prop<Names: ToNamesNotAll>( &self, dev_name: &str, attr_name: &str, names: Names, ) -> Result<()>

Delete the given properties of one attribute of that device, see Self::delete_dev_attr_prop_async.

Methods from Deref<Target = DevProxy>§

Source

pub fn backend(&self) -> &Arc<dyn Backend> ⓘ

Source

pub fn timeout(&self) -> Duration

Retrieve the timeout duration currently used for all requests.

Source

pub fn set_timeout(&mut self, timeout: Duration) -> Duration

Set the timeout duration and return the previous one. See Self::timeout.

Source

pub fn source(&self) -> DevSource

Retrieve the source of data currently used for attribute readings and commands.

Source

pub fn set_source(&mut self, source: DevSource) -> DevSource

Set the source of data and return the previous one. See Self::source.

Source

pub fn database(&self) -> Result<&DatabaseProxy>

Return the DatabaseProxy this device has been requested from, or this device as a database if it is one. A device reached without a database fails with ErrorKind::DatabaseNeeded.

Source

pub fn trl(&self) -> Result<ArcTrl>

Resolve this device’s fully qualified device name.

Source

pub fn connect(&self) -> Result<()>

Connect this proxy to its device if that has not happened yet, so that its clones share that connection instead of each making its own.

Source

pub async fn connect_async(&self) -> Result<()>

Connect this proxy to its device if that has not happened yet, see Self::connect.

Source

pub fn name(&self) -> Result<Arc<str>>

Resolve this device’s name.

Source

pub async fn name_async(&self) -> Result<Arc<str>>

Resolve this device’s name, see Self::name.

Source

pub fn admin_dev_name(&self) -> Result<Arc<str>>

Resolve this device’s admin device name.

Source

pub async fn admin_dev_name_async(&self) -> Result<Arc<str>>

Resolve this device’s admin device name, see Self::admin_dev_name.

Source

pub fn admin_dev(&self) -> Result<DevProxy>

Resolve this device’s admin device and return it!

Source

pub async fn admin_dev_async(&self) -> Result<DevProxy>

Resolve this device’s admin device and return it, see Self::admin_dev.

Source

pub fn info(&self) -> Result<DevInfo>

Get what the device says it is: the class it is an instance of, the server running it and where, and the versions of whatever that server is built out of.

All of it is the server’s own description of itself and none of it is asked of the database, so it answers for a device served without one.

Source

pub async fn info_async(&self) -> Result<DevInfo>

Get what the device says it is, see Self::info.

Source

pub fn ping(&self) -> Result<()>

Ping this device.

Source

pub async fn ping_async(&self) -> Result<()>

Ping this device, see Self::ping.

Source

pub fn state(&self) -> Result<DevState>

Get the device state.

Source

pub async fn state_async(&self) -> Result<DevState>

Get the device state, see Self::state.

Source

pub fn status(&self) -> Result<Scalar<str>>

Get the device status.

Source

pub async fn status_async(&self) -> Result<Scalar<str>>

Get the device status, see Self::status.

Source

pub fn init(&self) -> Result<()>

Initialize the device again, executing its Init command.

Source

pub fn init_async(&self) -> impl Future<Output = Result<()>> + Send

Initialize the device again, see Self::init.

Source

pub fn black_box(&self, max: Option<usize>) -> Result<Spectrum<str>>

Request the device black box.

Source

pub async fn black_box_async(&self, max: Option<usize>) -> Result<Spectrum<str>>

Request the device black box, see Self::black_box.

Source

pub fn command_async<I, O>( &self, name: &str, input: I, ) -> impl Future<Output = Result<O>> + Send
where I: IntoValue, O: FromValue,

Execute a remote command, giving back what it answered with, converted into the type it is expected to be, see FromValue.

The value shares the octets the device answered with, so asking for a Value or for one of the buffers it holds — a crate::value::Spectrum of a million points above all — copies nothing, where the usual owned types are copied out of it.

Source

pub fn command<I, O>(&self, name: &str, input: I) -> Result<O>
where I: IntoValue, O: FromValue,

Execute a remote command, giving back what it answered with, see Self::command_async.

Source

pub fn read_attr_async<Spec, Names: ToNames>( &self, names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: ReadAttrSpec<Names>,

Read attributes given a specification of attributes. This specification is really flexible and allows various signatures for the function:

  1. read_attr<T>(&str) -> Result<AttrRead<T>>
  2. read_attr<T>(&[&str]) -> Result<Vec<Result<AttrRead<T>>>>
  3. read_attr<T>([&str; N]) -> Result<[Result<AttrRead<T>>; N]>
  4. read_attr<(A, B, ...)>((&str, &str, ...)) -> Result<(Result<AttrRead<A>>, Result<AttrRead<B>>, ...)>
  5. read_attr<T>(All) -> Result<Vec<NamedResult<AttrRead<T>>>>

Forms 1 to 3 and 5 convert every attribute into the same type, whereas form 4 gives each attribute its own type. Nothing in the names constrains the specification, so it has to come either from a turbofish, leaving the names inferred as in read_attr::<i16, _>("enum_scalar"), or from the type of the binding it is assigned to. Reading into a Value keeps whatever the device answered with, and reading into a buffer copies nothing, see Self::command_async.

Each reading comes with the Result of that one reading, so that a per-attribute failure is seen without the whole request failing. Note that, unlike the many-attributes forms, the single-attribute form has no per-attribute slot in its output and therefore returns that attribute’s error directly. The fixed-size forms 3 and 4 additionally fail with ErrorKind::Internal if the device does not answer with exactly as many readings as were requested.

All requested attributes are read within a single request, which matters beyond saving round trips: if the device enforces serialization, it is held for the whole batch and only released at the end, so the readings are consistent with each other instead of being sampled at instants another client could have written between.

Source

pub fn read_attr<Spec, Names: ToNames>( &self, names: Names, ) -> Result<Spec::Output>
where Spec: ReadAttrSpec<Names>,

Read attributes, see Self::read_attr_async.

Source

pub fn write_attr_async<'a, Spec>( &self, spec: Spec, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: WriteAttrSpec<'a>,

Write attributes given a specification of attributes and their values, giving back the outcome of each individual write, in the order they were given. In Tango a write only carries a value: quality and timestamp cannot be written. Like for Self::read_attr, this specification is really flexible and allows various signatures for the function:

  1. write_attr((&str, T)) -> Result<()>
  2. write_attr(Vec<(&str, T)>) -> Result<Vec<Result<()>>>
  3. write_attr([(&str, T); N]) -> Result<[Result<()>; N]>
  4. write_attr(((&str, A), (&str, B), ...)) -> Result<(Result<()>, Result<()>, ...)>

Each written value only needs to implement IntoValue, so unlike for Self::read_attr the value types are inferred from the specification and never have to be named. Note that, unlike the many-attributes forms, the single-attribute form has no per-attribute slot in its output and therefore returns that attribute’s error directly. The fixed-size forms 3 and 4 fail with ErrorKind::Internal if the device does not answer for exactly as many attributes as were written.

Source

pub fn write_attr<'a, Spec>(&self, spec: Spec) -> Result<Spec::Output>
where Spec: WriteAttrSpec<'a>,

Write attributes, see Self::write_attr_async.

Source

pub fn write_read_attr_async<'a, Spec>( &self, spec: Spec, ) -> impl Future<Output = Result<<Spec::ReadSpec as ReadAttrSpec<Spec::ReadNames>>::Output>> + Send
where Spec: WriteAttrSpec<'a>, Spec::ReadSpec: ReadAttrSpec<Spec::ReadNames>,

Write attributes and read them back, given the same flexible specification as Self::write_attr, but returning the read-back values instead of unit results. Each value is converted back into the very type that was written:

  1. write_read_attr((&str, T)) -> Result<AttrRead<T>>
  2. write_read_attr(Vec<(&str, T)>) -> Result<Vec<Result<AttrRead<T>>>>
  3. write_read_attr([(&str, T); N]) -> Result<[Result<AttrRead<T>>; N]>
  4. write_read_attr(((&str, A), (&str, B), ...)) -> Result<(Result<AttrRead<A>>, Result<AttrRead<B>>, ...)>

The read is done by the server right after the write, so this saves a round trip compared to a Self::write_attr followed by a Self::read_attr, and no other request can interleave between the two when the device enforces serialization.

Because the read-back is converted back into the written type, each value type must also implement FromValue here, whereas Self::write_attr only requires IntoValue.

Source

pub fn write_read_attr<'a, Spec>( &self, spec: Spec, ) -> Result<<Spec::ReadSpec as ReadAttrSpec<Spec::ReadNames>>::Output>
where Spec: WriteAttrSpec<'a>, Spec::ReadSpec: ReadAttrSpec<Spec::ReadNames>,

Write attributes and read them back, see Self::write_read_attr_async.

Source

pub fn command_info_async<Spec: ToNamesSpec<CommandInfo>>( &self, spec: Spec, ) -> impl Future<Output = Result<Spec::Output>> + Send

Get the static information of commands, given the same flexible specification of names as Self::read_attr takes:

  1. command_info(&str) -> Result<CommandInfo>
  2. command_info(&[&str]) -> Result<Vec<Result<CommandInfo>>>
  3. command_info([&str; N]) -> Result<[Result<CommandInfo>; N]>
  4. command_info(All) -> Result<Vec<NamedResult<CommandInfo>>>

Every command comes with the Result of that one command, an unknown command name and a data type that no CommandDataKind has a variant for being the two the device answers with.

Note that, unlike the attributes, the Tango interface has no operation taking a list of command names, so asking for several of them costs one request each, where All only costs one for the whole listing.

Source

pub fn command_info<Spec: ToNamesSpec<CommandInfo>>( &self, spec: Spec, ) -> Result<Spec::Output>

Get the static information of commands, see Self::command_info_async.

Source

pub fn attr_info_async<Spec: ToNamesSpec<AttrInfo>>( &self, spec: Spec, ) -> impl Future<Output = Result<Spec::Output>> + Send

Get the static information of attributes, their runtime-modifiable configuration included, given the same flexible specification of names as Self::read_attr takes:

  1. attr_info(&str) -> Result<AttrInfo>
  2. attr_info(&[&str]) -> Result<Vec<Result<AttrInfo>>>
  3. attr_info([&str; N]) -> Result<[Result<AttrInfo>; N]>
  4. attr_info(All) -> Result<Vec<NamedResult<AttrInfo>>>

Every attribute comes with the Result of that one attribute, a data type that no AttrDataKind has a variant for being what the device answers with. Unlike the commands, an unknown attribute name may fail the whole request, all of them travelling in a single one, depending on the backend.

Source

pub fn attr_info<Spec: ToNamesSpec<AttrInfo>>( &self, spec: Spec, ) -> Result<Spec::Output>

Get the static information of attributes, see Self::attr_info_async.

Source

pub async fn set_attr_config_async( &self, values: &[(&str, AttrConfig)], ) -> Result<Vec<Result<()>>>

Change the configuration of the given attributes, giving back the outcome of each individual change, in the order they were given.

Only the configuration is writable, which is the part of an AttrInfo that a client is allowed to set: what an attribute is — its mode, its data kind and its format — is what its definition says and is never written from the outside.

The whole configuration of an attribute goes out every time, so changing one property of it is reading the configuration with Self::attr_info and writing back what was read with that one property changed, which is what the protocol carries.

A field with no value brings it back to what the attribute inherits from its class, if anything.

Source

pub fn set_attr_config( &self, values: &[(&str, AttrConfig)], ) -> Result<Vec<Result<()>>>

Change the configuration of the given attributes, see Self::set_attr_config_async.

Source

pub async fn command_history_async<T: FromValue>( &self, name: &str, max: usize, ) -> Result<Vec<RecordedResult<T>>>

The recorded history of a command, oldest entry first and at most max of them: what the polling of the device recorded, or the device itself, which may manage the history of a command it does not poll. Every entry is what the command answered then, converted into the type it is expected to be, a run that failed carrying the failure it failed with, see Recorded.

A command nothing was recorded of has no history to give, which is a failure and not an empty history, see ErrorKind::CommandNotPolled and ErrorKind::AttrNotPolled.

Source

pub fn command_history<T: FromValue>( &self, name: &str, max: usize, ) -> Result<Vec<RecordedResult<T>>>

The recorded history of a command, see Self::command_history_async.

Source

pub async fn attr_history_async<T: FromValue>( &self, name: &str, max: usize, ) -> Result<Vec<RecordedResult<AttrRead<T>>>>

The recorded history of an attribute, see Self::command_history_async, a reading carrying the time it was recorded at as its own.

Source

pub fn attr_history<T: FromValue>( &self, name: &str, max: usize, ) -> Result<Vec<RecordedResult<AttrRead<T>>>>

The recorded history of an attribute, see Self::attr_history_async.

Source

pub async fn poll_attr_async(&self, name: &str, period: Duration) -> Result<()>

Poll that attribute of this device at that period, or at another one if it is polled already, see the AddObjPolling and UpdObjPollingPeriod commands of the admin device.

Source

pub fn poll_attr(&self, name: &str, period: Duration) -> Result<()>

Poll that attribute of this device, see Self::poll_attr_async.

Source

pub async fn poll_command_async( &self, name: &str, period: Duration, ) -> Result<()>

Poll that command of this device, see Self::poll_attr_async: only a command taking no argument can be polled.

Source

pub fn poll_command(&self, name: &str, period: Duration) -> Result<()>

Poll that command of this device, see Self::poll_command_async.

Source

pub async fn stop_poll_attr_async(&self, name: &str) -> Result<()>

Stop polling that attribute of this device, failing if it is not polled, see the RemObjPolling command of the admin device.

Source

pub fn stop_poll_attr(&self, name: &str) -> Result<()>

Stop polling that attribute of this device, see Self::stop_poll_attr_async.

Source

pub async fn stop_poll_command_async(&self, name: &str) -> Result<()>

Stop polling that command of this device, see Self::stop_poll_attr_async.

Source

pub fn stop_poll_command(&self, name: &str) -> Result<()>

Stop polling that command of this device, see Self::stop_poll_command_async.

Source

pub async fn attr_poll_period_async( &self, name: &str, ) -> Result<Option<Duration>>

The period that attribute of this device is polled at, absent if it is not polled, out of its polling status, see Self::polling_status_async.

Source

pub fn attr_poll_period(&self, name: &str) -> Result<Option<Duration>>

The period that attribute of this device is polled at, see Self::attr_poll_period_async.

Source

pub async fn command_poll_period_async( &self, name: &str, ) -> Result<Option<Duration>>

The period that command of this device is polled at, see Self::attr_poll_period_async.

Source

pub fn command_poll_period(&self, name: &str) -> Result<Option<Duration>>

The period that command of this device is polled at, see Self::command_poll_period_async.

Source

pub async fn polling_status_async(&self) -> Result<Vec<String>>

The polling status of this device, one text per object polled, as its admin device gives it with its DevPollStatus command, none for a device that is not polled.

Source

pub fn polling_status(&self) -> Result<Vec<String>>

The polling status of this device, see Self::polling_status_async.

Source

pub async fn list_prop_async(&self, filter: &str) -> Result<Spectrum<str>>

The names of the properties of this device that match the given filter.

Source

pub fn list_prop(&self, filter: &str) -> Result<Spectrum<str>>

The names of the properties of this device, see Self::list_prop_async.

Source

pub fn get_prop_async<Spec, Names: ToNames>( &self, names: Names, ) -> impl Future<Output = Result<Spec::Output>> + Send
where Spec: GetPropSpec<Names>,

The properties of this device, parsed into the shape the given names ask for. Like for Self::read_attr, this specification is really flexible and allows various signatures for the function:

  1. get_prop<T>(&str) -> Result<T>
  2. get_prop<T>(&[&str]) -> Result<Vec<Result<T>>>
  3. get_prop<T>([&str; N]) -> Result<[Result<T>; N]>
  4. get_prop<(A, B, ...)>((&str, &str, ...)) -> Result<(Result<A>, Result<B>, ...)>
  5. get_prop<Spectrum<str>>(All) -> Result<Vec<Named<Spectrum<str>>>>

See DatabaseProxy::get_dev_prop_async for what the values may be parsed into and what a property the database holds nothing for gives.

Source

pub fn get_prop<Spec, Names: ToNames>( &self, names: Names, ) -> Result<Spec::Output>
where Spec: GetPropSpec<Names>,

The properties of this device, see Self::get_prop_async.

Source

pub fn set_prop_async<'a, Spec>( &self, spec: Spec, ) -> impl Future<Output = Result<()>> + Send
where Spec: SetPropSpec<'a>,

Write the given properties of this device, given as pairs of a name and a value, which allows various signatures for the function:

  1. set_prop((&str, T)) -> Result<()>
  2. set_prop([(&str, T); N]) -> Result<()>
  3. set_prop(Vec<(&str, T)>) -> Result<()>
  4. set_prop(((&str, A), (&str, B), ...)) -> Result<()>

See DatabaseProxy::set_dev_prop_async for what the values may be.

Source

pub fn set_prop<'a, Spec>(&self, spec: Spec) -> Result<()>
where Spec: SetPropSpec<'a>,

Write the given properties of this device, see Self::set_prop_async.

Source

pub fn delete_prop_async<Names: ToNamesNotAll>( &self, names: Names, ) -> impl Future<Output = Result<()>> + Send

Delete the given properties of this device, which allows various signatures for the function:

  1. delete_prop(&str) -> Result<()>
  2. delete_prop(&[&str]) -> Result<()>
  3. delete_prop([&str; N]) -> Result<()>
  4. delete_prop((&str, &str, ...)) -> Result<()>

See DatabaseProxy::delete_dev_prop_async.

Source

pub fn delete_prop<Names: ToNamesNotAll>(&self, names: Names) -> Result<()>

Delete the given properties of this device, see Self::delete_prop_async.

Source

pub fn subscribe_attr_value<T: FromValue>( &self, name: &str, event: AttrValueEvent, ) -> DevChannel<AttrRead<T>>

Subscribe to the readings of an attribute, of one of the kinds a device pushes them under, the channel giving the latest of them, see DevChannel.

Nothing is subscribed until the channel is polled, or its subscription ensured, see DevChannel::ensure_subscribed_async. There is no initial value: the first event is the next one the device pushes, so read the attribute once subscribed to know where it stands.

Source

pub fn subscribe_attr_ready(&self, name: &str) -> DevChannel<AttrReady>

Subscribe to an attribute being announced as ready to be read, which carries nothing of the reading: making it is the subscriber’s to do, see AttrReady. See Self::subscribe_attr_value.

Source

pub fn subscribe_attr_config(&self, name: &str) -> DevChannel<AttrInfo>

Subscribe to the configuration of an attribute changing, every event carrying the configuration as it stands after the change. See Self::subscribe_attr_value.

Trait Implementations§

Source§

impl Clone for DatabaseProxy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DatabaseProxy

Source§

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

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

impl Deref for DatabaseProxy

Source§

type Target = DevProxy

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for DatabaseProxy

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Eq for DatabaseProxy

Source§

impl Hash for DatabaseProxy

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for DatabaseProxy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DatabaseProxy

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Model for T
where T: Send + Sync + 'static,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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