Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattnenterprise/rust-nntp
NNTP client for Rust
https://github.com/mattnenterprise/rust-nntp
nntp-client rust rust-nntp
Last synced: 3 months ago
JSON representation
NNTP client for Rust
- Host: GitHub
- URL: https://github.com/mattnenterprise/rust-nntp
- Owner: mattnenterprise
- License: apache-2.0
- Created: 2014-11-23T23:23:53.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-12-19T21:53:20.000Z (about 4 years ago)
- Last Synced: 2024-10-12T01:37:51.974Z (3 months ago)
- Topics: nntp-client, rust, rust-nntp
- Language: Rust
- Homepage:
- Size: 21.5 KB
- Stars: 17
- Watchers: 2
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-rust-cn - mattnenterprise/rust-nntp - ci.org/mattnenterprise/rust-nntp.svg?branch=master">](https://travis-ci.org/mattnenterprise/rust-nntp) (Libraries / Network programming)
- awesome-rust - mattnenterprise/rust-nntp - ci.org/mattnenterprise/rust-nntp.svg?branch=master">](https://travis-ci.org/mattnenterprise/rust-nntp) (Libraries / Network programming)
- awesome-rust - mattnenterprise/rust-nntp
- awesome-rust-cn - mattnenterprise/rust-nntp
- awesome-rust-zh - mattnenterprise/rust-nntp - 一个 Rust 的[NNTP](https://en.wikipedia.org/wiki/Network_News_Transfer_Protocol)客户端[<img src="https://api.travis-ci.org/mattnenterprise/rust-nntp.svg?branch=master">](https://travis-ci.org/mattnenterprise/rust-nntp) (库 / 网络编程)
README
rust-nntp
================
NNTP Client for Rust[![Build Status](https://travis-ci.org/mattnenterprise/rust-imap.svg)](https://travis-ci.org/mattnenterprise/rust-imap)
[![crates.io](http://meritbadge.herokuapp.com/nntp)](https://crates.io/crates/nntp)### Usage
```rust
extern crate nntp;use nntp::{Article, 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(groups) => {
for group in groups.iter() {
println!("Name: {}, High: {}, Low: {}, Status: {}", group.name, group.high, group.low, group.status)
}
},
Err(e) => panic!(e)
};match nntp_stream.group("comp.sys.raspberry-pi") {
Ok(_) => (),
Err(e) => panic!(e)
}match nntp_stream.article_by_number(6187) {
Ok(Article{headers, body}) => {
for (key, value) in headers.iter() {
println!("{}: {}", key, value)
}
for line in body.iter() {
print!("{}", line)
}
},
Err(e) => panic!(e)
}match nntp_stream.article_by_id("") {
Ok(Article{headers, body}) => {
for (key, value) in headers.iter() {
println!("{}: {}", key, value)
}
for line in body.iter() {
print!("{}", line)
}
},
Err(e) => panic!(e)
}let _ = nntp_stream.quit();
}
```### License
MIT
## LicenseLicensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.