ResponseCode

Enum ResponseCode 

Source
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

Source

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.

Source

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.

Source

pub fn status_code(&self) -> Option<u16>

Get the numeric status code if available

Source

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

Source§

fn clone(&self) -> ResponseCode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResponseCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ResponseCode

Source§

fn eq(&self, other: &ResponseCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ResponseCode

Source§

impl Eq for ResponseCode

Source§

impl StructuralPartialEq for ResponseCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more