http-rs / async-sse Goto Github PK
View Code? Open in Web Editor NEWAsync Server Sent Events parser and encoder
Home Page: https://docs.rs/async-sse
License: Apache License 2.0
Async Server Sent Events parser and encoder
Home Page: https://docs.rs/async-sse
License: Apache License 2.0
this issue exists as a bookmark that there might be improvements over using an Arc<Mutex>
, such as possibly something from crossbeam
Seeing the following error after running pin-project-lite
released version 0.1.9.
error[E0453]: allow(explicit_outlives_requirements) overruled by outer forbid(rust_2018_idioms)
--> /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/async-sse-4.0.0/src/encoder.rs:9:1
|
9 | / pin_project_lite::pin_project! {
10 | | /// An SSE protocol encoder.
11 | | #[derive(Debug)]
12 | | pub struct Encoder {
... |
17 | | }
18 | | }
| |_^ overruled by previous forbid
|
::: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/async-sse-4.0.0/src/lib.rs:34:11
|
34 | #![forbid(rust_2018_idioms)]
| ---------------- `forbid` level set here
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0453]: allow(explicit_outlives_requirements) overruled by outer forbid(rust_2018_idioms)
--> /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/async-sse-4.0.0/src/lines.rs:11:1
|
11 | / pin_project! {
12 | | /// A stream of lines in a byte stream.
13 | | ///
14 | | /// This stream is created by the [`lines`] method on types that implement [`BufRead`].
... |
28 | | }
29 | | }
| |_^ overruled by previous forbid
|
::: /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/async-sse-4.0.0/src/lib.rs:34:11
|
34 | #![forbid(rust_2018_idioms)]
| ---------------- `forbid` level set here
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Hello, I was reading through the Encoder
's AsyncRead
impl:
Lines 40 to 52 in 50db988
I noticed that self.cursor
wasn't being used to slice local_buf
. So, it might be possible to copy the same section of local_buf
multiple times.
#3 adds support for detecting disconnections through a custom Arc<AtomicBool>
. This is not particularly efficient, but it works.
https://docs.rs/async-channel/1.1.1/async_channel/'s channels have a Sender that returns an error on disconnect; exactly as we would expect here. We should use this instead of our custom AtomicBool
impl. async-std
is expected to move over to this as well in the near future, but we shouldn't wait for that.
@jbr could you pick this up?
I'm trying to integrate this crate with a stream using http request. I'm relatively new to wasm. Not sure if it's possible. Thanks!
The server-sent events standard does not require the event
field. I'd like to be able to send events with no event
field.
I can think of several possible ways to do this:
send
method to take an Option<&str>
. This would be the simplest to implement, but would necessitate a major version bump, and would require passing Some("name")
when providing an event name, which may be inconvenient for the common case.Option<&str>
, and keep the existing method as a convenience wrapper.I'd be happy to provide the implementation. Which approach would you prefer?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.