coded_chars/
transmission.rs

1//! All transmission-related characters.
2
3/// # Start of heading
4///
5/// SOH is used to indicate the beginning of a heading.
6pub const SOH: char = '\x01';
7
8/// # Start of text
9///
10/// STX is used to indicate the beginning of a text and the end of a heading.
11pub const STX: char = '\x02';
12
13/// # End of text
14///
15/// ETX is used to indicate the end of a text.
16pub const ETX: char = '\x03';
17
18/// # End of transmission
19///
20/// EOT is used to indicate the conclusion of the transmission of one or more texts.
21pub const EOT: char = '\x04';
22
23/// # Enquiry
24///
25/// ENQ is transmitted by a sender as a request for a response from a receiver.
26pub const ENQ: char = '\x05';
27
28/// # Acknowledge
29///
30/// ACK is transmitted by a receiver as an affirmative response to the sender.
31pub const ACK: char = '\x06';
32
33/// # Data link escape
34///
35/// DLE is used exclusively to provide supplementary transmission control functions.
36pub const DLE: char = '\x10';
37
38/// # Negative Acknowledge
39///
40/// NAK is transmitted by a receiver as a negative response to the sender.
41pub const NAK: char = '\x15';
42
43/// # Synchronous idle
44///
45/// SYN is used by a synchronous transmission system in the absence of any other character (idle condition) to
46/// provide a signal from which synchronism may be achieved or retained between data terminal equipment.
47pub const SYN: char = '\x16';
48
49/// # End of transmission block
50///
51/// ETB is used to indicate the end of a block of data where the data are divided into such blocks for transmission purposes.
52pub const ETB: char = '\x17';
53
54
55#[cfg(test)]
56mod tests {
57    use super::*;
58
59    #[test]
60    fn test_soh() {
61        assert_eq!(SOH, '\x01');
62    }
63
64    #[test]
65    fn test_stx() {
66        assert_eq!(STX, '\x02');
67    }
68
69    #[test]
70    fn test_etx() {
71        assert_eq!(ETX, '\x03');
72    }
73
74    #[test]
75    fn test_eot() {
76        assert_eq!(EOT, '\x04');
77    }
78
79    #[test]
80    fn test_enq() {
81        assert_eq!(ENQ, '\x05');
82    }
83
84    #[test]
85    fn test_ack() {
86        assert_eq!(ACK, '\x06');
87    }
88
89    #[test]
90    fn test_dle() {
91        assert_eq!(DLE, '\x10');
92    }
93
94    #[test]
95    fn test_nak() {
96        assert_eq!(NAK, '\x15');
97    }
98
99    #[test]
100    fn test_syn() {
101        assert_eq!(SYN, '\x16');
102    }
103
104    #[test]
105    fn test_etb() {
106        assert_eq!(ETB, '\x17');
107    }
108}