pub fn give(&mut self, cap: &CapabilityRef<T>, data: (D, T, R)) {
        // Retain a cap for the current time, which will be used on flush.
        if self.cap.as_ref().map_or(true, |t| t.time() != cap.time()) {
            // Flush on capability change
            self.flush();
            // Retain capability for the specified output port.
            self.cap = Some(cap.delayed_for_output(cap.time(), self.port));
        }
        self.buffer.push(data);
        if self.buffer.len() == self.buffer.capacity() {
            // Consolidate while the consolidation frees at least half the buffer
            consolidate_updates(&mut self.buffer);
            if self.buffer.len() > self.buffer.capacity() / 2 {
                self.flush();
            }
        }
    }
/// Give an element to the buffer
Give an element to the buffer
Give an element to the buffer
pub fn give(&mut self, cap: &CapabilityRef<T>, data: (D, T, R)) {
        // Retain a cap for the current time, which will be used on flush.
        if self.cap.as_ref().map_or(true, |t| t.time() != cap.time()) {
            // Flush on capability change
            self.flush();
            // Retain capability for the specified output port.
            self.cap = Some(cap.delayed_for_output(cap.time(), self.port));
        }
        self.buffer.push(data);
        if self.buffer.len() == self.buffer.capacity() {
            // Consolidate while the consolidation frees at least half the buffer
            consolidate_updates(&mut self.buffer);
            if self.buffer.len() > self.buffer.capacity() / 2 {
                self.flush();
            }
        }
    }
pub fn give ( & mut self , cap : & CapabilityRef < T > , data : ( D , T , R ) ) { // Retain a cap for the current time, which will be used on flush. if self . cap . as_ref ( ) . map_or ( true , | t | t . time ( ) != cap . time ( ) ) { // Flush on capability change self . flush ( ) ; // Retain capability for the specified output port. self . cap = Some ( cap . delayed_for_output ( cap . time ( ) , self . port ) ) ; } self . buffer . push ( data ) ; if self . buffer . len ( ) == self . buffer . capacity ( ) { // Consolidate while the consolidation frees at least half the buffer consolidate_updates ( & mut self . buffer ) ; if self . buffer . len ( ) > self . buffer . capacity ( ) / 2 { self . flush ( ) ; } } }
Give an element to the buffer
Give an element to the buffer
&mut self
cap
&CapabilityRef<T>
data
(D, T, R)
&mut self
cap
&CapabilityRef<T>
data
(D, T, R)