collab-common 0.0.7

Code shared by collab's client and server
Documentation
use serde::{Deserialize, Serialize};

use crate::{PeerId, SessionId};

/// The initial request sent by the client to the server after establishing a
/// TCP connection.
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub enum InitRequest {
    /// The client wants to create a new session and join it with the given
    /// [`PeerId`].
    Start(PeerId),

    /// The client wants to join the session identified by the [`SessionId`]
    /// with the given [`PeerId`].
    Join(SessionId, PeerId),
}

impl crate::encode::ShouldCompress for InitRequest {
    #[inline(always)]
    fn should_compress(&self) -> bool {
        false
    }
}