std::sync::mpsc::SyncSender - Rust
Description: API documentation for the Rust `SyncSender` struct in crate `std`.
Keywords: rust, rustlang, rust-lang, SyncSender

# Struct std::sync::mpsc::SyncSender 1.0.0 [−] [src]

    pub struct SyncSender<T> { /* fields omitted */ }

The sending-half of Rust's synchronous channel type. This half can only be owned by one thread, but it can be cloned to send to other threads.

## Methods

### `impl<T> SyncSender<T>`
[src]

#### `fn send(&self, t: T) -> Result<(), SendError<T>>`

Sends a value on this synchronous channel.

This function will block until space in the internal buffer becomes available or a receiver is available to hand off the message to.

Note that a successful send does not guarantee that the receiver will ever see the data if there is a buffer on this channel. Items may be enqueued in the internal buffer for the receiver to receive at a later time. If the buffer size is 0, however, it can be guaranteed that the receiver has indeed received the data if this function returns success.

This function will never panic, but it may return `Err` if the `Receiver` has disconnected and is no longer able to receive information.

#### `fn try_send(&self, t: T) -> Result<(), TrySendError<T>>`

Attempts to send a value on this channel without blocking.

This method differs from `send` by returning immediately if the channel's buffer is full or no receiver is waiting to acquire some data. Compared with `send`, this function has two failure cases instead of one (one for disconnection, one for a full buffer).

See `SyncSender::send` for notes about guarantees of whether the receiver has received the data or not if this function is successful.

## Trait Implementations

### `impl<T: Send> Send for SyncSender<T>`
[src]

### `impl<T> !Sync for SyncSender<T>`
[src]

### `impl<T> Clone for SyncSender<T>`
[src]

#### `fn clone(&self) -> SyncSender<T>`

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`

Performs copy-assignment from `source`. Read more

### `impl<T> Drop for SyncSender<T>`
[src]

#### `fn drop(&mut self)`

A method called when the value goes out of scope. Read more

### `impl<T> Debug for SyncSender<T>`
1.7.0
[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result`

Formats the value using the given formatter.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand 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`)