Skip to main content

PGenericSocketManager

Struct PGenericSocketManager 

Source
pub struct PGenericSocketManager<TSocketKey, TBackend, TMockBackend>{ /* private fields */ }
Expand description

Socket manager for PGenericSocket

Implementations§

Source§

impl<TSocketKey, TBackend, TMockBackend> PGenericSocketManager<TSocketKey, TBackend, TMockBackend>

Source

pub fn new( mode: PSocketMode, ) -> PGenericSocketManager<TSocketKey, TBackend, TMockBackend>

Create a PGenericSocketManager

§Parameters
  • mode - mode of the PGenericSocketManager
§Returns

constructed PGenericSocketManager

Source

pub fn set_mode(&mut self, mode: PSocketMode)

Set the mode of the PGenericSocketManager and to all PGenericSocket children

§Parameters
  • mode - mode of the PGenericSocketManager
Source

pub fn get_mode(&self) -> PSocketMode

Get the mode of the PGenericSocketManager

§Returns

mode of the PGenericSocketManager

Source

pub fn add_client_socket( &mut self, name: TSocketKey, socket_param: &PSocketParam, extra_param: &<TBackend as AbstractSocketBackend>::Param, mock_prefix: &String, mock_param: &<TMockBackend as AbstractSocketBackend>::Param, ) -> bool

Add a client socket

§Parameters
  • name : name of the socket
  • socket_param : parameters of the socket (host, port, send/recv timeout)
  • extra_param : extra parameters of the backend
  • mock_prefix : prefix where to find/save the mock
  • mock_param : extra parameters of the mock
§Returns

true on success, false otherwise

Source

pub fn add_server_socket( &mut self, name: TSocketKey, socket_param: &PSocketParam, extra_param: &<TBackend as AbstractSocketBackend>::Param, mock_prefix: &String, mock_param: &<TMockBackend as AbstractSocketBackend>::Param, ) -> bool

Add a server socket

§Parameters
  • name : name of the socket
  • socket_param : parameters of the socket (host, port, send/recv timeout)
  • extra_param : extra parameters of the backend
  • mock_prefix : prefix where to find/save the mock
  • mock_param : extra parameters of the mock
§Returns

true on success, false otherwise

Source

pub fn send<T>( &mut self, name: TSocketKey, data: &T, flag: PSendFlag, ) -> PSendStatus
where T: Default + DataStream + Debug,

Method to send data

§Parameters
  • name : name of the socket to be used
  • data : data to be sent
  • flag : PSendFlag to determine if the send is blocking or not
§Returns

corresponding PSendStatus

Source

pub fn recv<T>( &mut self, name: TSocketKey, data: &mut T, flag: PRecvFlag, ) -> PRecvStatus
where T: Default + DataStream + Debug,

Method to recieved data

§Parameters
  • name : name of the socket to be used
  • data : recieved data
  • flag : PRecvFlag to determine if the recv is blocking or not
§Returns

corresponding PRecvStatus

Source

pub fn remove_socket(&mut self, name: TSocketKey)

Remove the given socket

§Parameters
  • name : name of the socket to be removed
Source

pub fn close(&mut self)

Close all sockets

Trait Implementations§

Source§

impl<TSocketKey, TBackend, TMockBackend> Drop for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>

Source§

fn drop(&mut self)

Destructor of the PGenericSocketManager

Auto Trait Implementations§

§

impl<TSocketKey, TBackend, TMockBackend> Freeze for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized, <TBackend as AbstractSocketBackend>::Socket: Sized, TBackend: Freeze, TMockBackend: Freeze,

§

impl<TSocketKey, TBackend, TMockBackend> RefUnwindSafe for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized + RefUnwindSafe, <TBackend as AbstractSocketBackend>::Socket: Sized + RefUnwindSafe, TBackend: RefUnwindSafe, TMockBackend: RefUnwindSafe, TSocketKey: RefUnwindSafe,

§

impl<TSocketKey, TBackend, TMockBackend> Send for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized + Send, <TBackend as AbstractSocketBackend>::Socket: Sized + Send, TBackend: Send, TMockBackend: Send, TSocketKey: Send,

§

impl<TSocketKey, TBackend, TMockBackend> Sync for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized + Sync, <TBackend as AbstractSocketBackend>::Socket: Sized + Sync, TBackend: Sync, TMockBackend: Sync, TSocketKey: Sync,

§

impl<TSocketKey, TBackend, TMockBackend> Unpin for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized, <TBackend as AbstractSocketBackend>::Socket: Sized, TBackend: Unpin, TMockBackend: Unpin, TSocketKey: Unpin,

§

impl<TSocketKey, TBackend, TMockBackend> UnsafeUnpin for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized, <TBackend as AbstractSocketBackend>::Socket: Sized, TBackend: UnsafeUnpin, TMockBackend: UnsafeUnpin,

§

impl<TSocketKey, TBackend, TMockBackend> UnwindSafe for PGenericSocketManager<TSocketKey, TBackend, TMockBackend>
where <TMockBackend as AbstractSocketBackend>::Socket: Sized + UnwindSafe, <TBackend as AbstractSocketBackend>::Socket: Sized + UnwindSafe, TBackend: UnwindSafe, TMockBackend: UnwindSafe, TSocketKey: UnwindSafe,

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