[][src]Struct pubnub_hyper::Builder

pub struct Builder<TTransport = (), TRuntime = ()> { /* fields omitted */ }

PubNub Client Builder

Create a crate::PubNub client using the builder pattern. Optional items can be overridden using this.

Methods

impl<TTransport, TRuntime> Builder<TTransport, TRuntime> where
    TRuntime: Runtime,
    TTransport: Transport
[src]

#[must_use]pub fn build(self) -> PubNub<TTransport, TRuntime>[src]

Build the PubNub client to begin streaming messages.

Example

use pubnub_core::mock::{runtime::MockRuntime, transport::MockTransport};
use pubnub_core::Builder;

let transport = MockTransport::new();
let runtime = MockRuntime::new();

let pubnub = Builder::with_components(transport, runtime).build();

impl<TTransport, TRuntime> Builder<TTransport, TRuntime>[src]

#[must_use]pub fn with_components(
    transport: TTransport,
    runtime: TRuntime
) -> Builder<TTransport, TRuntime>
[src]

Create a new Builder that can configure a PubNub client with custom component implementations.

Example

use pubnub_core::mock::{runtime::MockRuntime, transport::MockTransport};
use pubnub_core::Builder;

let transport = MockTransport::new();
let runtime = MockRuntime::new();

let pubnub = Builder::with_components(transport, runtime).build();

#[must_use]pub fn subscribe_loop_exit_tx(
    self,
    tx: Sender<()>
) -> Builder<TTransport, TRuntime>
[src]

Set the subscribe loop exit tx.

If set, subscribe loop sends a message to it when it exits.

Example

use pubnub_core::Builder;

let (tx, _rx) = futures_channel::mpsc::channel(1);

let pubnub = Builder::with_components(transport, runtime)
    .subscribe_loop_exit_tx(tx)
    .build();

#[must_use]pub fn transport<U>(self, transport: U) -> Builder<U, TRuntime> where
    U: Transport
[src]

Set the transport to use.

This allows changing the [Transport] type on the builder and, therefore, on the resulting PubNub client.

#[must_use]pub fn runtime<U>(self, runtime: U) -> Builder<TTransport, U> where
    U: Runtime
[src]

Set the runtime to use.

This allows changing the [Runtime] type on the builder and, therefore, on the resulting PubNub client.

impl Builder<(), ()>[src]

#[must_use]pub fn new() -> Builder<(), ()>[src]

Create a new Builder that can configure a PubNub client.

Example

use pubnub_core::mock::{runtime::MockRuntime, transport::MockTransport};
use pubnub_core::Builder;

let transport = MockTransport::new();
let runtime = MockRuntime::new();

let pubnub = Builder::new().transport(transport).runtime(runtime).build();

Trait Implementations

impl<TTransport, TRuntime> Clone for Builder<TTransport, TRuntime> where
    TRuntime: Clone,
    TTransport: Clone
[src]

impl<TTransport, TRuntime> Debug for Builder<TTransport, TRuntime> where
    TRuntime: Debug,
    TTransport: Debug
[src]

impl<TTransport, TRuntime> Default for Builder<TTransport, TRuntime> where
    TRuntime: Default,
    TTransport: Default
[src]

#[must_use]fn default() -> Builder<TTransport, TRuntime>[src]

Create a new Builder that can configure a PubNub client with default components.

Auto Trait Implementations

impl<TTransport = (), TRuntime = ()> !RefUnwindSafe for Builder<TTransport, TRuntime>

impl<TTransport, TRuntime> Send for Builder<TTransport, TRuntime> where
    TRuntime: Send,
    TTransport: Send

impl<TTransport, TRuntime> Sync for Builder<TTransport, TRuntime> where
    TRuntime: Sync,
    TTransport: Sync

impl<TTransport, TRuntime> Unpin for Builder<TTransport, TRuntime> where
    TRuntime: Unpin,
    TTransport: Unpin

impl<TTransport = (), TRuntime = ()> !UnwindSafe for Builder<TTransport, TRuntime>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,