The CircuitBase trait has a method defined this way:
/// Reference to the global counter shared by all circuits.
fn last_stream_id(&self) -> RefCell<StreamId>;
I don't understand the return type. Returning a RefCell by value is like returning a Mutex by value; it doesn't give you any kind of reference. If this method is supposed to return a reference to something, then it should return a reference. As-is, it's effectively just returning the last stream ID wrapped in a RefCell.