Skip to content

Example for an empty stream for stubbing #94

@ydirson

Description

@ydirson

I'm working on a project where I use async_stream for interfacing with an optional crate. I wish to propose a stub for platforms that don't have support for this crate.

The following naive attempt does not work (the compiler tells me I'd rather use unit type as return value), likely because the lack of a yield does not allow the macro to derive an iterm type:

    pub fn stream(&mut self) -> impl Stream<Item = io::Result<NetEvent>> + '_ {
        try_stream! {
        }
    }

How can I achieve that ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions