rust-nntp

Crates.iorust-nntp
lib.rsrust-nntp
version0.0.1
sourcesrc
created_at2014-11-24 00:23:21.836161
updated_at2015-12-11 23:56:40.231265
descriptionNNTP client for Rust
homepage
repositoryhttps://github.com/mattnenterprise/rust-nntp
max_upload_size
id379
size14,765
Matt McCoy (mattnenterprise)

documentation

README

rust-nntp

NNTP Client for Rust

Build Status

Installation

Add nntp via your Cargo.toml:

[dependencies.pop3]
git = "https://github.com/mattnenterprise/rust-nntp"

Usage

extern crate nntp;

use nntp::{NNTPStream};

fn main() {
	let mut nntp_stream = match NNTPStream::connect("nntp.aioe.org", 119) {
		Ok(stream) => stream,
		Err(e) => panic!("{}", e)
	};

	match nntp_stream.capabilities() {
		Ok(lines) => {
			for line in lines.iter() {
				print!("{}", line);
			}
		},
		Err(e) => panic!(e)
	}

	match nntp_stream.list() {
		Ok(lines) => {
			for line in lines.iter() {
				print!("{}", line);
			}
		},
		Err(e) => panic!(e)
	};

	match nntp_stream.group("comp.sys.raspberry-pi") {
		Ok(_) => (),
		Err(e) => panic!(e)
	}

	match nntp_stream.article_by_number(6000) {
		Ok(lines) => {
			for line in lines.iter() {
				print!("{}", line);
			}
		},
		Err(e) => panic!(e)
	}

	match nntp_stream.article_by_id("<E2w*P06cv@news.chiark.greenend.org.uk>") {
		Ok(lines) => {
			for line in lines.iter() {
				print!("{}", line);
			}
		},
		Err(e) => panic!(e)
	}	

	let _ = nntp_stream.quit();
}

License

MIT

Commit count: 22

cargo fmt