pub struct NntpClient { /* private fields */ }Expand description
Standalone NNTP client for fetching articles
Zero-allocation design using caller-provided buffer pool.
Share one pool across multiple clients for minimal allocations.
Returns PooledBuffer - caller parses with Article::parse().
Implementations§
Source§impl NntpClient
impl NntpClient
Sourcepub const fn new(
conn_pool: DeadpoolConnectionProvider,
buffer_pool: BufferPool,
) -> Self
pub const fn new( conn_pool: DeadpoolConnectionProvider, buffer_pool: BufferPool, ) -> Self
Create a new client with connection pool and buffer pool
The buffer pool can be shared across multiple clients via Clone.
Sourcepub fn fetch_body(
&self,
message_id: &MessageId<'_>,
) -> impl Future<Output = Result<PooledBuffer>> + '_
pub fn fetch_body( &self, message_id: &MessageId<'_>, ) -> impl Future<Output = Result<PooledBuffer>> + '_
Fetch article body (BODY command)
Returns PooledBuffer with the backend response bytes.
Parse with Article::parse(&buffer, validate_yenc).
§Arguments
message_id- Message-ID including angle brackets, e.g.<abc@example.com>
§Errors
Returns any connection, write, or backend-response error encountered while fetching the BODY response.
Sourcepub fn fetch_head(
&self,
message_id: &MessageId<'_>,
) -> impl Future<Output = Result<PooledBuffer>> + '_
pub fn fetch_head( &self, message_id: &MessageId<'_>, ) -> impl Future<Output = Result<PooledBuffer>> + '_
Fetch article headers (HEAD command)
Returns PooledBuffer with the backend response bytes.
Parse with Article::parse(&buffer, false).
§Arguments
message_id- Message-ID including angle brackets
§Errors
Returns any connection, write, or backend-response error encountered while fetching the HEAD response.
Sourcepub fn fetch_article(
&self,
message_id: &MessageId<'_>,
) -> impl Future<Output = Result<PooledBuffer>> + '_
pub fn fetch_article( &self, message_id: &MessageId<'_>, ) -> impl Future<Output = Result<PooledBuffer>> + '_
Fetch full article (ARTICLE command)
Returns PooledBuffer with the backend response bytes.
Parse with Article::parse(&buffer, validate_yenc).
§Arguments
message_id- Message-ID including angle brackets
§Errors
Returns any connection, write, or backend-response error encountered while fetching the ARTICLE response.
Trait Implementations§
Source§impl Clone for NntpClient
impl Clone for NntpClient
Source§fn clone(&self) -> NntpClient
fn clone(&self) -> NntpClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for NntpClient
impl !UnwindSafe for NntpClient
impl Freeze for NntpClient
impl Send for NntpClient
impl Sync for NntpClient
impl Unpin for NntpClient
impl UnsafeUnpin for NntpClient
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more