pub enum ResponseCode {
    Greeting(u16),
    Disconnect,
    AuthRequired(u16),
    AuthSuccess,
    MultilineData(u16),
    SingleLine(u16),
    Invalid,
}Expand description
Categorized NNTP response code for type-safe handling
This enum categorizes NNTP response codes based on their semantics and handling requirements per RFC 3977 §3.2.
§Response Code Ranges
Per RFC 3977 §3.2.1:
- 1xx: Informational (multiline data follows)
 - 2xx: Success (may be multiline)
 - 3xx: Success so far, further input expected
 - 4xx: Temporary failure
 - 5xx: Permanent failure
 
Variants§
Greeting(u16)
Server greeting - RFC 3977 §5.1
- 200: Posting allowed
 - 201: No posting allowed
 
Disconnect
Disconnect/goodbye - RFC 3977 §5.4
- 205: Connection closing
 
AuthRequired(u16)
Authentication required - RFC 4643 §2.3
- 381: Password required
 - 480: Authentication required
 
AuthSuccess
Authentication successful - RFC 4643 §2.5.1
- 281: Authentication accepted
 
MultilineData(u16)
Multiline data response Per RFC 3977 §3.4.1:
- All 1xx codes (100-199)
 - Specific 2xx codes: 215, 220, 221, 222, 224, 225, 230, 231, 282
 
SingleLine(u16)
Single-line response (everything else)
Invalid
Invalid or unparseable response
Implementations§
Source§impl ResponseCode
 
impl ResponseCode
Sourcepub fn parse(data: &[u8]) -> Self
 
pub fn parse(data: &[u8]) -> Self
Parse response data into a categorized response code
Per RFC 3977 §3.2, responses start with a 3-digit status code.
Optimization: Direct byte-to-digit conversion avoids UTF-8 overhead.
Sourcepub fn is_multiline(&self) -> bool
 
pub fn is_multiline(&self) -> bool
Check if this response type is multiline
Per RFC 3977 §3.4.1, multiline responses require special handling with terminator detection.
Sourcepub fn status_code(&self) -> Option<u16>
 
pub fn status_code(&self) -> Option<u16>
Get the numeric status code if available
Sourcepub fn is_success(&self) -> bool
 
pub fn is_success(&self) -> bool
Check if this is a success response (2xx or 3xx)
Per RFC 3977 §3.2.1:
- 2xx: Success
 - 3xx: Success so far, send more input
 
Trait Implementations§
Source§impl Clone for ResponseCode
 
impl Clone for ResponseCode
Source§fn clone(&self) -> ResponseCode
 
fn clone(&self) -> ResponseCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResponseCode
 
impl Debug for ResponseCode
Source§impl PartialEq for ResponseCode
 
impl PartialEq for ResponseCode
impl Copy for ResponseCode
impl Eq for ResponseCode
impl StructuralPartialEq for ResponseCode
Auto Trait Implementations§
impl Freeze for ResponseCode
impl RefUnwindSafe for ResponseCode
impl Send for ResponseCode
impl Sync for ResponseCode
impl Unpin for ResponseCode
impl UnwindSafe for ResponseCode
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.