Skip to main content

BackendServerConfig

Struct BackendServerConfig 

Source
#[non_exhaustive]
pub struct BackendServerConfig { pub host: Option<String>, pub port: Option<(u16, u16)>, pub admin_name: Option<Arc<str>>, pub tango_host: Option<(Arc<str>, u16)>, pub zmq_heartbeat_port: Option<(u16, u16)>, pub zmq_event_port: Option<(u16, u16)>, }
Expand description

How a backend serves, see Backend::serve, whatever is not given being left to the backend, which is what the default configuration is.

A range of ports is given by both its ends, which are included, so that it holds at least one port. A range including port 0 is the system picking any port, whatever the other end, the same as giving none.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§host: Option<String>

The host to listen at, an address or a name of this machine, every one of its interfaces if none is given.

§port: Option<(u16, u16)>

The port (or range of ports) to listen at, one the system picks if none is given, which is what a Tango device server does: its clients find it through the database, where it is exported. A fixed port is what a server without a database needs, its clients having nothing else to find it by. The port range has both ends inclusive.

§admin_name: Option<Arc<str>>

The name of the admin device of the server being served, dserver/exe/inst, which names the event channel of the server: a backend not given one publishes no event.

§tango_host: Option<(Arc<str>, u16)>

The host and port of the database the server is registered in, which prefixes the names of its events. A server without a database prefixes them with its own host and port instead, marking them as such.

§zmq_heartbeat_port: Option<(u16, u16)>

The port (or range of ports) the ZMQ backend may use for its heartbeat PUB socket. This should be ignored by backends without ZMQ. The port range has both ends inclusive.

§zmq_event_port: Option<(u16, u16)>

The port (or range of ports) the ZMQ backend may use for its event PUB socket. This should be ignored by backends without ZMQ. The port range has both ends inclusive.

Implementations§

Source§

impl BackendServerConfig

Source

pub fn new() -> Self

Everything left to the backend.

Source

pub fn host(self, host: &str) -> Self

Listen at that host, see Self::host.

Source

pub fn port<R: RangeBounds<u16>>(self, port: R) -> Self

Listen at that port, see Self::port.

Source

pub fn admin_name(self, admin_name: impl Into<Arc<str>>) -> Self

Serve the server of that admin device, see Self::admin_name.

Source

pub fn tango_host(self, host: impl Into<Arc<str>>, port: u16) -> Self

Serve a server registered in the database at that host and port, see Self::tango_host.

Source

pub fn zmq_heartbeat_port<R: RangeBounds<u16>>(self, port: R) -> Self

Make ZMQ listen at this port for its heartbeat, see Self::zmq_heartbeat_port.

Source

pub fn zmq_event_port<R: RangeBounds<u16>>(self, port: R) -> Self

Make ZMQ listen at this port for its events, see Self::zmq_event_port.

Trait Implementations§

Source§

impl Clone for BackendServerConfig

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 BackendServerConfig

Source§

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

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

impl Default for BackendServerConfig

Source§

fn default() -> Self

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

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<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