async fn monitor_value<K, V>(
    mut value: V,
    requestee: Requestee<V>,
) -> MonitorKind<K, V>
where
    V: Perishable,
{
    // The monitor completes if either of the following completes:
    #![allow(clippy::mut_mut)]
    futures::select!(
        // The value has perished.
        _ = value.perished().fuse() => {},

        // The value has been requested to be fetched back out,
        // or the requester for the value has been dropped.
        return_sender = requestee.fuse() => {
            // We should get a return sender, because we shouldn't drop the
            // requester before sending a return sender.
            //
            // A failure to send the value means the value requester gave up
            // waiting for the value.
            let _ = return_sender
                .expect("requester dropped before sending return sender")
                .send(value);
        },
    );

    // The output indicates that this future dealt with a value stored
    // in the pantry (by either dropping it or sending it back out).
    MonitorKind::Value
}
// This is used to create a monitor which holds onto a value and watches
// to see if it perishes.  The monitor can also receive a request to pass
// the value back out before it perishes.
This is used to create a monitor which holds onto a value and watches
to see if it perishes.  The monitor can also receive a request to pass
the value back out before it perishes.
This is used to create a monitor which holds onto a value and watches to see if it perishes . The monitor can also receive a request to pass the value back out before it perishes .
async fn monitor_value<K, V>(
    mut value: V,
    requestee: Requestee<V>,
) -> MonitorKind<K, V>
where
    V: Perishable,
{
    // The monitor completes if either of the following completes:
    #![allow(clippy::mut_mut)]
    futures::select!(
        // The value has perished.
        _ = value.perished().fuse() => {},
        // The value has been requested to be fetched back out,
        // or the requester for the value has been dropped.
        return_sender = requestee.fuse() => {
            // We should get a return sender, because we shouldn't drop the
            // requester before sending a return sender.
            //
            // A failure to send the value means the value requester gave up
            // waiting for the value.
            let _ = return_sender
                .expect("requester dropped before sending return sender")
                .send(value);
        },
    );
    // The output indicates that this future dealt with a value stored
    // in the pantry (by either dropping it or sending it back out).
    MonitorKind::Value
}
async fn monitor_value < K , V > ( mut value : V , requestee : Requestee < V > , ) -> MonitorKind < K , V > where V : Perishable , { // The monitor completes if either of the following completes: # ! [ allow ( clippy mut_mut ) ] futures :: select ! ( // The value has perished. value perished ( ) fuse ( ) { } // The value has been requested to be fetched back out, // or the requester for the value has been dropped. return_sender requestee fuse ( ) { // We should get a return sender, because we shouldn't drop the // requester before sending a return sender. // A failure to send the value means the value requester gave up // waiting for the value. let return_sender expect ( " " ) send ( value ) } ) ; // The output indicates that this future dealt with a value stored // in the pantry (by either dropping it or sending it back out). MonitorKind :: Value }
This is used to create a monitor which holds onto a value and watches
to see if it perishes.
This is used to create a monitor which holds onto a value and watches to see if it perishes .
value
V
requestee
Requestee<V>
value
V
requestee
Requestee<V>