Struct ConnectionBuilder

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

Builder for creating a new SMPP connection.

Implementations§

Source§

impl ConnectionBuilder

Source

pub fn new() -> Self

Creates a new ConnectionBuilder.

Source

pub async fn connect( self, host: impl ToSocketAddrs, ) -> Result<(Client, impl Stream<Item = Event> + Unpin + Debug + 'static), Error>

Connects to the SMPP server and performs the bind operation.

Opens and manages a connection in the background and returns a client and an event stream.

  • The client is used as a handle to communicate with the server through the managed connection.
  • The event stream is used to receive events from the server, such as incoming messages or errors.
Source

pub async fn connected<S>( self, stream: S, ) -> Result<(Client, impl Stream<Item = Event> + Unpin + Debug + 'static), Error>
where S: AsyncRead + AsyncWrite + Send + Unpin + 'static,

Performs the bind operation on an already connected stream.

Manages a connection in the background and returns a client and an event stream.

  • The client is used as a handle to communicate with the server through the managed connection.
  • The event stream is used to receive events from the server, such as incoming messages or errors.
Source§

impl ConnectionBuilder

Source

pub const fn max_command_length(self, max_command_length: usize) -> Self

Sets the maximum command length for incoming commands.

Source

pub const fn bind_mode(self, bind_mode: BindMode) -> Self

Sets the bind mode for the connection.

Source

pub const fn transmitter(self) -> Self

Sets the bind mode to transmitter.

Source

pub const fn receiver(self) -> Self

Sets the bind mode to receiver.

Source

pub const fn transceiver(self) -> Self

Sets the bind mode to transceiver (both transmitter and receiver).

Source

pub fn system_id(self, system_id: COctetString<1, 16>) -> Self

Sets the system ID.

Source

pub fn password(self, password: COctetString<1, 9>) -> Self

Sets the password.

Source

pub fn system_type(self, system_type: COctetString<1, 13>) -> Self

Sets the system type.

Source

pub fn addr_ton(self, addr_ton: Ton) -> Self

Sets the address TON (Type of Number).

Source

pub fn addr_npi(self, addr_npi: Npi) -> Self

Sets the address NPI (Numbering Plan Indicator).

Source

pub fn address_range(self, address_range: COctetString<1, 41>) -> Self

Sets the address range.

Sets the enquire link interval.

Used to determine how often an enquire link command should be sent to the server.

Source

pub fn response_timeout(self, response_timeout: Duration) -> Self

Sets the response timeout.

This timeout is used to determine how long the client should wait for a response from the server.

Trait Implementations§

Source§

impl Debug for ConnectionBuilder

Source§

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

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

impl Default for ConnectionBuilder

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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