Implement Hash and PartialOrd for RingBuf

cc #15294