pub struct Connection {
pub id: ConnectionId,
pub addr: SocketAddr,
pub connected_at: Instant,
pub metadata: HashMap<String, String>,
pub rooms: Vec<RoomId>,
}Expand description
连接信息
Fields§
§id: ConnectionId连接 ID
addr: SocketAddr客户端地址
connected_at: Instant连接时间
metadata: HashMap<String, String>用户自定义数据
rooms: Vec<RoomId>所属房间列表
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new(id: ConnectionId, addr: SocketAddr) -> Self
pub fn new(id: ConnectionId, addr: SocketAddr) -> Self
创建新连接
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
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