Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f8b6fc0
make Encodable object safe
museun Oct 16, 2020
b158c3b
move to a workspace structure
museun Oct 18, 2020
2246779
fix examples
museun Oct 18, 2020
f1c996b
remove async-dup
museun Oct 18, 2020
4bc9f2b
update all of the manifests
museun Oct 18, 2020
3683a0d
correct runner module documentation
museun Oct 18, 2020
2b7403d
remove the URN from the websocket addresses
museun Oct 18, 2020
15d1870
remove dead code
museun Oct 18, 2020
af81527
Merge branch 'dyn-write' into dev
museun Oct 18, 2020
3220239
remove From conversion for Raw->IrcMessage. closes #214
museun Oct 18, 2020
5f09fdb
make connectors future-safe
museun Oct 18, 2020
9de2410
a refactor
museun Oct 19, 2020
3e8f8d3
feature gate privmsg ext on writer
museun Oct 19, 2020
9044112
add websocket encoder/decoder
museun Oct 19, 2020
c27c820
move crates to root
museun Oct 19, 2020
32bf0fd
fix manifest
museun Oct 20, 2020
9d555e8
split writer and 'split' module off
museun Oct 21, 2020
0a959b9
remove dead code from simple_bot
museun Oct 21, 2020
2b586da
move ws into its own module
museun Oct 21, 2020
1f904a3
fix simple_bot example
museun Oct 21, 2020
4085627
rename wait_for_read to wait_until_ready
museun Oct 21, 2020
86f67ab
rework everything into 3 distinct modules
museun Oct 28, 2020
538cfc3
temp. remove examples, add websocket connector
museun Oct 28, 2020
07de984
zap readme
museun Oct 28, 2020
bcb8c67
impl Stream for StreamDecoder
museun Oct 28, 2020
f92b85d
more documentation
museun Oct 28, 2020
42711fb
forward port utf-8 safe tag parsing
museun Nov 20, 2020
fdda1fd
forward port 6b49e3b628aaf67a97720bd70578712beb1917b7
museun Nov 20, 2020
425e84e
bump deps
museun Nov 20, 2020
e71837d
slightly cleanup
museun Nov 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 15 additions & 115 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,117 +1,17 @@
[package]
name = "twitchchat"
edition = "2018"
version = "0.14.5"
authors = ["museun <[email protected]>"]
keywords = ["twitch", "irc", "async", "asynchronous", "tokio"]
license = "MIT OR Apache-2.0"
readme = "README.md"
description = "interface to the irc-side of twitch's chat system"
documentation = "https://docs.rs/twitchchat/latest/twitchchat/"
repository = "https://github.com/museun/twitchchat"
categories = ["asynchronous", "network-programming", "parser-implementations"]

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
all-features = true

[features]
default = []
testing = [
"async",
"async-mutex",
]

async = [
"async-channel",
"async-dup",
"fastrand",
"futures-lite",
"futures-timer",
"log",
"pin-project-lite",
[workspace]
members = [
"twitchchat",
"twitchchat_async_io",
"twitchchat_async_net",
"twitchchat_async_std",
"twitchchat_smol",
"twitchchat_tokio",
"twitchchat_tokio02",
"twitchchat_tungstenite",

# internal crates
# "examples"
]

[dependencies]
# logging support
log = { version = "0.4", optional = true, features = ["std"] }

# just the futures traits
futures-lite = { version = "1.11", optional = true }

# field pin projection
pin-project-lite = { version = "0.1", optional = true }

# cloneable async writes
async-dup = { version = "1.2", optional = true }

# message passing
async-channel = { version = "1.5", optional = true }

# for timing out futures
futures-timer = { version = "3.0", optional = true }

# for 'fairness' in the main loop
fastrand = { version = "1.4", optional = true }

# for optional serialization and deserialization
serde = { version = "1.0", features = ["derive"], optional = true }

# optional runtimes (for TcpStream)
# these use the futures AsyncWrite+AsyncRead
async-io = { version = "1.1", optional = true }
smol = { version = "1.2", optional = true }
async-tls = { version = "0.10", default-features = false, features = ["client"], optional = true }
# TODO look into what their features do. the ones they have enabled by default seem important
async-std = { version = "1.6", optional = true }

# tokio has its own AsyncWrite+AsyncRead
tokio = { version = "0.3", features = ["net"], optional = true }
tokio-util = { version = "0.4", features = ["compat"], optional = true }

# rustls
tokio-rustls = { version = "0.20", optional = true }
webpki-roots = { version = "0.20", optional = true }

# native-tls
tokio-native-tls = { version = "0.2", optional = true }
native-tls = { version = "0.2", optional = true }

# openssl
tokio-openssl = { version = "0.5", optional = true }
openssl = { version = "0.10", optional = true, features = ["v111"] }

# for some test utilities
async-mutex = { version = "1.4", optional = true }


[dev-dependencies]
anyhow = "1.0.33"
async-executor = { version = "1.3.0", default-features = false }
serde_json = "1.0.59"
rmp-serde = "0.14.4"

[[example]]
name = "message_parse"
required-features = ["async"]

[[example]]
name = "smol_demo"
required-features = ["smol", "async"]

[[example]]
name = "async_io_demo"
required-features = ["async-io", "async"]

[[example]]
name = "async_std_demo"
required-features = ["async-std", "async-std/attributes", "async"]

[[example]]
name = "tokio_demo"
required-features = ["tokio/full", "tokio-util", "async"]

[[example]]
name = "simple_bot"
required-features = ["smol", "async"]

[patch.crates-io]
twitchchat = { path = "twitchchat" }
78 changes: 2 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,9 @@
[![Crates][crates_badge]][crates]
[![Actions][actions_badge]][actions]

This crate provides a way to interact with [Twitch]'s chat.
This crate provides a way to interact with [Twitch][twitch]'s chat.

Along with parse messages as Rust types, it provides methods for sending messages.

It also provides an 'event' loop which you can use to make a bot.

## Opt-in features

By default, this crate depends on zero external crates -- but it makes it rather limited in scope. It can just parse/decode/encode to standard trait types (`std::io::{Read, Write}`).

To use the `AsyncRunner` (an async-event loop) you must able the `async` feature.

**_NOTE_** This is a breaking change from `0.12` which had the async stuff enabled by default.

```toml
twitchchat = { version = "0.14", features = ["async"] }
```

To use a specific `TcpStream`/`TlStream` refer to the runtime table below.

## Serde support

To enable serde support, simply enable the optional `serde` feature

## Runtime

This crate is runtime agonostic. To use..

| Read/Write provider | Features |
| ---------------------------------------------------------- | ------------------------ |
| [`async_io`](https://docs.rs/async-io/latest/async_io/) | `async-io` |
| [`smol`](https://docs.rs/smol/latest/smol/) | `smol` |
| [`async_std`](https://docs.rs/async-std/latest/async_std/) | `async-std` |
| [`tokio`](https://docs.rs/tokio/0.2/tokio/) | `tokio` and `tokio-util` |

### TLS

If you want TLS supports, enable the above runtime and also enable the cooresponding features:

| Read/Write provider | Runtime | Features | TLS backend |
| ---------------------------------------------------------- | ----------- | ---------------------------------------------------- | -------------------------- |
| [`async_io`](https://docs.rs/async-io/latest/async_io/) | `async_io` | `"async-tls"` | [`rustls`][rustls] |
| [`smol`](https://docs.rs/smol/latest/smol/) | `smol` | `"async-tls"` | [`rustls`][rustls] |
| [`async_std`](https://docs.rs/async-std/latest/async_std/) | `async_std` | `"async-tls"` | [`rustls`][rustls] |
| [`tokio`](https://docs.rs/tokio/0.2/tokio/) | `tokio` | `"tokio-util"`, `"tokio-rustls"`, `"webpki-roots"` | [`rustls`][rustls] |
| [`tokio`](https://docs.rs/tokio/0.2/tokio/) | `tokio` | `"tokio-util"`, `"tokio-native-tls"`, `"native-tls"` | [`native-tls`][native-tls] |
| [`tokio`](https://docs.rs/tokio/0.2/tokio/) | `tokio` | `"tokio-util"`, `"tokio-openssl"`, `"openssl"` | [`openssl`][openssl] |

[rustls]: https://docs.rs/rustls/0.18.1/rustls/
[native-tls]: https://docs.rs/native-tls/0.2.4/native_tls/
[openssl]: https://docs.rs/openssl/0.10/openssl/

## Examples

#### Using async_io to connect with..

- [async_io_demo.rs](./examples/async_io_demo.rs)

#### Using async_std to connect with..

- [async_std_demo.rs](./examples/async_std_demo.rs)

#### Using smol to connect with..

- [smol_demo.rs](./examples/smol_demo.rs)

#### Using tokio to connect with..

- [tokio_demo.rs](./examples/tokio_demo.rs)

#### How to use the crate as just a message parser(decoder)/encoder

- [message_parse.rs](./examples/message_parse.rs)

#### An a simple example of how one could built a bot with this

- [simple_bot.rs](./examples/simple_bot.rs)
# Note, This branch is a major WIP for the next (`v0.15.0`) release

## License

Expand Down
85 changes: 0 additions & 85 deletions examples/async_io_demo.rs

This file was deleted.

84 changes: 0 additions & 84 deletions examples/async_std_demo.rs

This file was deleted.

Loading