Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value selecting in inbox #561

Open
Thomasdezeeuw opened this issue Nov 1, 2021 · 0 comments
Open

Value selecting in inbox #561

Thomasdezeeuw opened this issue Nov 1, 2021 · 0 comments
Labels
enhancement An improvement of the API.

Comments

@Thomasdezeeuw
Copy link
Owner

Allows the user to select a message from the inbox.

impl<T> Receiver<T> {
    pub fn try_select<S>(&self, selector: S) -> Result<T, RecvError>
        where S: MessageSelector,
    {
        // ...
    }

    pub fn select<S>(&self, selector: S) -> SelectValue<'r, T> // Future<Output = Result<T, RecvError>>
        where S: MessageSelector,
    {
        // ...
    }
}

/// Select a message to receive.
pub trait MessageSelector<M> {
    /// Select what message to receive.
    fn select<'m>(&mut self, messages: Messages<'m, M>) -> Option<MessageSelection>;
}

/// The type used to indicate what message to select.
pub struct MessageSelection(usize);

/// Iterator for available messages.
pub struct Messages {
    // ...
}
@Thomasdezeeuw Thomasdezeeuw added the enhancement An improvement of the API. label Nov 1, 2021
@Thomasdezeeuw Thomasdezeeuw transferred this issue from Thomasdezeeuw/inbox Feb 25, 2023
@Thomasdezeeuw Thomasdezeeuw changed the title Value selecting Value selecting in inbox Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of the API.
Projects
None yet
Development

No branches or pull requests

1 participant