Struct spirit_tokio::UdpListen[][src]

pub struct UdpListen<ExtraCfg = Empty, ScaleMode: Scaled = Scale> { /* fields omitted */ }

A configuration fragment describing a bound UDP socket.

This is similar to TcpListen, but for UDP sockets. While the action on a TCP socket is called for each new accepted connection, the action for UDP socket is used to handle the whole UDP socket created from this configuration.

Type parameters

  • ExtraCfg: Extra options folded into this configuration, for application specific options. They are passed to the action.
  • ScaleMode: How scaling should be done. If scaling is enabled, the action should handle situation where it runs in multiple instances. However, even in case scaling is disabled, the action needs to handle being „restarted“ ‒ if there's a new configuration for the socket, the old future is dropped and new one, with a new socket, is created.

Configuration options

In addition to options provided by the above type parameters, these are present:

  • host: The hostname/interface to bind to. Defaults to *.
  • port: The port to bind the UDP socket to (mandatory). While it is possible to create unbound UDP sockets with an OS-assigned port, these don't need the configuration and are not created by this configuration fragment.

Methods

impl<ExtraCfg, ScaleMode> UdpListen<ExtraCfg, ScaleMode> where
    ExtraCfg: Clone + Debug + PartialEq + Send + 'static,
    ScaleMode: Scaled
[src]

Returns a helper for handling reconfiguration of the UDP sockets.

While it can be used manually, it is usually used through the spirit::Builder::config_helper with extractor returning an iterator of UdpListen.

Trait Implementations

impl<ExtraCfg: Clone, ScaleMode: Clone + Scaled> Clone for UdpListen<ExtraCfg, ScaleMode>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<ExtraCfg: Debug, ScaleMode: Debug + Scaled> Debug for UdpListen<ExtraCfg, ScaleMode>
[src]

Formats the value using the given formatter. Read more

impl<ExtraCfg: Default, ScaleMode: Default + Scaled> Default for UdpListen<ExtraCfg, ScaleMode>
[src]

Returns the "default value" for a type. Read more

impl<ExtraCfg: Eq, ScaleMode: Eq + Scaled> Eq for UdpListen<ExtraCfg, ScaleMode>
[src]

impl<ExtraCfg: PartialEq, ScaleMode: PartialEq + Scaled> PartialEq for UdpListen<ExtraCfg, ScaleMode>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<ExtraCfg: Ord, ScaleMode: Ord + Scaled> Ord for UdpListen<ExtraCfg, ScaleMode>
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<ExtraCfg: PartialOrd, ScaleMode: PartialOrd + Scaled> PartialOrd for UdpListen<ExtraCfg, ScaleMode>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<ExtraCfg: Hash, ScaleMode: Hash + Scaled> Hash for UdpListen<ExtraCfg, ScaleMode>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<S, O, C, Action, Fut, ExtraCfg, ScaleMode> IteratedCfgHelper<S, O, C, Action> for UdpListen<ExtraCfg, ScaleMode> where
    S: Borrow<ArcSwap<C>> + Sync + Send + 'static,
    C: Deserialize<'de> + Send + Sync + 'static,
    O: Debug + StructOpt + Sync + Send + 'static,
    ExtraCfg: Clone + Debug + PartialEq + Send + 'static,
    Action: Fn(&Arc<Spirit<S, O, C>>, UdpSocket, &ExtraCfg) -> Fut + Sync + Send + 'static,
    Fut: Future<Item = (), Error = Error> + Send + 'static,
    ScaleMode: Scaled
[src]

Perform the transformation of the builder. Read more

impl<S, O, C, Action, Fut, ExtraCfg, ScaleMode> CfgHelper<S, O, C, Action> for UdpListen<ExtraCfg, ScaleMode> where
    S: Borrow<ArcSwap<C>> + Sync + Send + 'static,
    C: Deserialize<'de> + Send + Sync + 'static,
    O: Debug + StructOpt + Sync + Send + 'static,
    ExtraCfg: Clone + Debug + PartialEq + Send + 'static,
    Action: Fn(&Arc<Spirit<S, O, C>>, UdpSocket, &ExtraCfg) -> Fut + Sync + Send + 'static,
    Fut: Future<Item = (), Error = Error> + Send + 'static,
    ScaleMode: Scaled
[src]

Perform the creation and application of the helper. Read more

Auto Trait Implementations

impl<ExtraCfg, ScaleMode> Send for UdpListen<ExtraCfg, ScaleMode> where
    ExtraCfg: Send,
    ScaleMode: Send

impl<ExtraCfg, ScaleMode> Sync for UdpListen<ExtraCfg, ScaleMode> where
    ExtraCfg: Sync,
    ScaleMode: Sync