# [−][src]Function crossbeam_channel::never

    pub fn never<T>() -> Receiver<T>

Creates a receiver that never delivers messages.

The channel is bounded with capacity of 0 and never gets disconnected.

# Examples

Using a `never` channel to optionally add a timeout to `select!`:

    use std::thread;
    use std::time::{Duration, Instant};
    use crossbeam_channel::{after, never, unbounded};

    let (s, r) = unbounded();

    thread::spawn(move || {
        thread::sleep(Duration::from_secs(1));
        s.send(1).unwrap();
    });

    // Suppose this duration can be a `Some` or a `None`.
    let duration = Some(Duration::from_millis(100));

    // Create a channel that times out after the specified duration.
    let timeout = duration
        .map(|d| after(d))
        .unwrap_or(never());

    select! {
        recv(r) -> msg => assert_eq!(msg, Ok(1)),
        recv(timeout) -> _ => println!("timed out"),
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)