@@ -14,6 +14,7 @@ module Streamly.Memory.Ring
1414 , new
1515 , advance
1616 , moveBy
17+ , startOf
1718
1819 -- * Modification
1920 , unsafeInsert
@@ -58,6 +59,10 @@ data Ring a = Ring
5859 , ringBound :: {-# UNPACK #-} !(Ptr a) -- first address beyond allocated memory
5960 }
6061
62+-- | Get the first address of the ring as a pointer.
63+startOf :: Ring a -> Ptr a
64+startOf = unsafeForeignPtrToPtr . ringStart
65+
6166-- | Create a new ringbuffer and return the ring buffer and the ringHead.
6267-- Returns the ring and the ringHead, the ringHead is same as ringStart.
6368{-# INLINE new #-}