telnet/negotiation.rs
1// This implements the Q method described in Section 7 of RFC 1143
2
3use crate::byte::{BYTE_DO, BYTE_DONT, BYTE_WILL, BYTE_WONT};
4
5/// Actions for telnet negotiation.
6#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
7pub enum Action {
8 Will,
9 Wont,
10 Do,
11 Dont,
12}
13
14impl Action {
15 #[allow(clippy::must_use_candidate)]
16 pub fn as_byte(&self) -> u8 {
17 match *self {
18 Action::Will => BYTE_WILL,
19 Action::Wont => BYTE_WONT,
20 Action::Do => BYTE_DO,
21 Action::Dont => BYTE_DONT,
22 }
23 }
24}