pub struct GnsSocket<S> { /* private fields */ }
Expand description
GnsSocket
is the most important structure of this library.
This structure is used to create client (GnsSocket<IsClient>
) and server (GnsSocket<IsServer>
) sockets via the GnsSocket::connect
and GnsSocket::listen
functions.
The drop implementation make sure that everything related to this structure is correctly freed, except the GnsGlobal
instance and the user has a strong guarantee that all the available operations over the socket are safe.
Implementations§
Source§impl<S> GnsSocket<S>where
S: IsReady,
impl<S> GnsSocket<S>where
S: IsReady,
Sourcepub fn get_connection_real_time_status(
&self,
GnsConnection: GnsConnection,
nb_of_lanes: u32,
) -> GnsResult<(GnsConnectionRealTimeStatus, Vec<GnsConnectionRealTimeLaneStatus>)>
pub fn get_connection_real_time_status( &self, GnsConnection: GnsConnection, nb_of_lanes: u32, ) -> GnsResult<(GnsConnectionRealTimeStatus, Vec<GnsConnectionRealTimeLaneStatus>)>
Get a connection lane status. This call is possible only if lanes has been previously configured using configure_connection_lanes
pub fn get_connection_info( &self, GnsConnection: GnsConnection, ) -> Option<GnsConnectionInfo>
pub fn flush_messages_on_connection( &self, GnsConnection: GnsConnection, ) -> GnsResult<()>
pub fn close_connection( &self, GnsConnection: GnsConnection, reason: u32, debug: &str, linger: bool, ) -> bool
pub fn poll_messages<const K: usize>( &self, message_callback: impl FnMut(&GnsNetworkMessage<ToReceive>), ) -> Option<usize>
pub fn poll_event<const K: usize>( &self, event_callback: impl FnMut(GnsConnectionEvent), ) -> usize
pub fn configure_connection_lanes( &self, GnsConnection: GnsConnection, lanes: &[GnsLane], ) -> GnsResult<()>
pub fn send_messages( &self, messages: Vec<GnsNetworkMessage<ToSend>>, ) -> Vec<Either<GnsMessageNumber, EResult>>
Source§impl GnsSocket<IsCreated>
impl GnsSocket<IsCreated>
Source§impl GnsSocket<IsClient>
impl GnsSocket<IsClient>
Sourcepub fn connection(&self) -> GnsConnection
pub fn connection(&self) -> GnsConnection
Return the socket connection. This operation is available only if the socket is in the IsClient
state.
Auto Trait Implementations§
impl<S> Freeze for GnsSocket<S>where
S: Freeze,
impl<S> RefUnwindSafe for GnsSocket<S>where
S: RefUnwindSafe,
impl<S> Send for GnsSocket<S>where
S: Send,
impl<S> Sync for GnsSocket<S>where
S: Sync,
impl<S> Unpin for GnsSocket<S>where
S: Unpin,
impl<S> UnwindSafe for GnsSocket<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more