Struct reqchan::ResponseContract [] [src]

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

This is the contract returned by a successful Responder::try_response(). It represents the caller's exclusive access to the responding side of the channel. It ensures the user sends a datum by panicking if they have not.

Methods

impl<T> ResponseContract<T>
[src]

[src]

This method tries to send a datum to the requesting end of the channel. It will then consume itself, thereby freeing the responding side of the channel.

Arguments

  • datum - The item(s) to send

Example

extern crate reqchan as chan;

let (requester, responder) = chan::channel::<u32>(); 

let mut request_contract = requester.try_request().unwrap();

let mut response_contract = responder.try_respond().unwrap();

// We send data to the requesting end.
response_contract.send(9);

println!("Number is {}", request_contract.try_receive().unwrap());

Trait Implementations

impl<T> Drop for ResponseContract<T>
[src]

[src]

Executes the destructor for this type. Read more