ptr::RawPtr, spell out units used for the offset argument.

spell out units used for the `offset` argument, so that callers do not
try to scale to byte units themselves.
This commit is contained in:
Felix S. Klock II 2014-02-20 14:58:46 +01:00
parent 882c25fa2d
commit e2f99b93cd

View file

@ -213,7 +213,8 @@ pub trait RawPtr<T> {
/// be pointing to invalid memory.
unsafe fn to_option(&self) -> Option<&T>;
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
/// the object, or one-byte-past-the-end.
/// the object, or one-byte-past-the-end. `count` is in units of T; e.g. a
/// `count` of 3 represents a pointer offset of `3 * sizeof::<T>()` bytes.
unsafe fn offset(self, count: int) -> Self;
}