pub struct Client {
pub id: usize,
pub stream: ClientStream,
pub map: Arc<Mutex<HashMap<String, ClientMapValue>>>,
pub plugins_manager: PluginsManagerType,
}Expand description
Client struct
Fields§
§id: usizeID of the client
stream: ClientStreamConnection stream of the client
map: Arc<Mutex<HashMap<String, ClientMapValue>>>Custom Client Map
plugins_manager: PluginsManagerTypePlugins Manager
Implementations§
Source§impl Client
impl Client
Sourcepub fn new_websocket(stream: TcpStream, id: usize) -> Result<Self>
pub fn new_websocket(stream: TcpStream, id: usize) -> Result<Self>
Create a new WebSocket Client instance
Sourcepub fn peer_addr(&self) -> Result<SocketAddr>
pub fn peer_addr(&self) -> Result<SocketAddr>
Returns the socket address of the remote peer of this connection.
Sourcepub fn flush(&self) -> Result<()>
pub fn flush(&self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Sourcepub fn insert_key<S>(
&self,
key: S,
value: ClientMapValue,
) -> Option<ClientMapValue>where
S: ToString,
pub fn insert_key<S>(
&self,
key: S,
value: ClientMapValue,
) -> Option<ClientMapValue>where
S: ToString,
Inserts a key-value pair into the map.
Sourcepub fn get_value<S>(&self, key: S) -> Option<ClientMapValue>where
S: ToString,
pub fn get_value<S>(&self, key: S) -> Option<ClientMapValue>where
S: ToString,
Returns the value from the key.
Sourcepub fn delete_key<S>(&self, key: S) -> Option<ClientMapValue>where
S: ToString,
pub fn delete_key<S>(&self, key: S) -> Option<ClientMapValue>where
S: ToString,
Delete key from the map.
pub async fn run_events( &self, event_type: EventType, event_data: EventData, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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