Skip to main content

PMockSocket

Struct PMockSocket 

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

The PMockSocket defines a mock backend which implements the AbstractClockBackend trait and is able to play, record and replay a set of time

Trait Implementations§

Source§

impl AbstractSocket for PMockSocket

Source§

type Message = Vec<u8>

Message to be used with the backend

Source§

type Param = PMockParam

Extra parameters to be used with the backend

Source§

fn create_client_socket( &mut self, _param: &PSocketParam, _extra_param: &Self::Param, ) -> bool

Create a client Socket

§Parameters
  • _param : parameters to be used to create the basic socket (hostname, port)
  • _extra_param : extra parameters to be used to create the socket
§Returns

True on success, false otherwise

Source§

fn create_server_socket( &mut self, param: &PSocketParam, extra_param: &Self::Param, ) -> bool

Create a server Socket

§Parameters
  • param : parameters to be used to create the basic socket (hostname, port)
  • extra_param : extra parameters to be used to create the socket
§Returns

True on success, false otherwise

Source§

fn send_data<T: Default + DataStream + Debug>( &mut self, data: &T, flag: PSendFlag, ) -> PSendStatus

Abstract method to send data

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

corresponding PSendStatus

Source§

fn recv_data<T: Default + DataStream + Debug>( &mut self, data: &mut T, flag: PRecvFlag, ) -> PRecvStatus

Abstract method to recieved data

§Parameters
  • data : recieved data
  • flag : PRecvFlag to determine if the recv is blocking or not
§Returns

corresponding PRecvStatus

Source§

fn send_msg(&mut self, msg: &DataStreamMessage, _flag: PSendFlag) -> PSendStatus

Method to send data

§Parameters
  • msg : message to be sent
  • _flag : PSendFlag to determine if the send is blocking or not
§Returns

corresponding PSendStatus

Source§

fn recv_msg( &mut self, msg: &mut DataStreamMessage, _flag: PRecvFlag, ) -> PRecvStatus

Abstract method to recieved data

§Parameters
  • msg : recieved message
  • _flag : PRecvFlag to determine if the recv is blocking or not
§Returns

corresponding PRecvStatus

Source§

fn close(&mut self)

Close the socket

Source§

fn is_connected(&mut self) -> bool

Say if the socket is connected

§Returns

true if the socket is connected, false otherwise

Source§

impl AbstractSocketMock for PMockSocket

Source§

fn set_is_record(&mut self, is_mock_record: bool)

Set the record mode in the mock

§Parameters
  • is_mock_record - true if the mock is in record mode
Source§

fn set_prefix(&mut self, prefix: &String)

Set the prefix of the current socket mock

§Parameters
  • prefix - prefix of the current socket mock
Source§

impl Debug for PMockSocket

Source§

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

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

impl Default for PMockSocket

Source§

fn default() -> Self

Create a PMockSocket

§Returns

constructed PMockSocket

Source§

impl Drop for PMockSocket

Source§

fn drop(&mut self)

Destructor of the PMockSocket

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