hanabi-core 0.1.0-alpha.2

Core library for Hanabi
Documentation
use serde::{Deserialize, Serialize};

/// Request types related to the control channel.
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum ControlRequest {
    /// Request used to create and open a new stream with the specified type.
    OpenStream(StreamType),
}

/// Type of the stream to open.
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum StreamType {
    /// Both the client and server can read and reply from the stream
    /// this is used on parts of the protocol that need a communication
    /// in a Request-Response fashion.
    Bidirectional,

    /// Stream where only the client is allowed to send messages and
    /// only the server is allowed to read messages.
    ClientStream,

    /// Stream where only the server is allowed to send messages and
    /// only the client is allowed to read messages.
    ServerStream,
}