Coder Social home page Coder Social logo

Comments (4)

zesterer avatar zesterer commented on August 15, 2024 1

Thinking about this carefully, I think this would be possible to implement: but not without adding some overhead to the crate. I might be able to hide it behind a non-default feature to ensure that most crate users don't need to pay the overhead, however.

That said, I'm not sure how this would interact with the async feature: the implementation could end up getting quite complex.

For this reason, I'm reluctant to do this at the current time. I'm actually working on a complete implementation overhaul of the crate that might make implementing this significantly easier, however. If I end up implementing this, I'll let you know.

from flume.

zesterer avatar zesterer commented on August 15, 2024 1

As a point of interest, the into_inner method was added in c13d0a4 and is now in version 0.10.6.

from flume.

zesterer avatar zesterer commented on August 15, 2024

This is already supported!

https://docs.rs/flume/0.10.5/flume/struct.Sender.html#method.try_send

The function returns a Result, with TrySendError<T> as the Err variant, allowing you to get back the value. For example:

match tx.try_send(foo) {
    Ok(()) => /* Successfully sent */,
    Err(TrySendError::Full(foo)) | Err(TrySendError::Disconnected(foo)) => /* Failed to send */,
}

I could probably make this easier with an fn into_inner(self) -> T on TrySendError though. I'll add this to the next release!

from flume.

let4be avatar let4be commented on August 15, 2024

Um... This is great news!

What do you think about Permit API?
Sometimes I find myself in a situation where I need to write en-bulk and all items are already there(no need to wait for), could such use case be made faster with Permits?

from flume.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.