Skip to main content

check_views

Function check_views 

Source
pub fn check_views<B: AsRef<[u8]>>(
    views: &[u8],
    data: &[B],
    len: u64,
    path: &str,
) -> Result<()>
Expand description

Checks that every view points inside a data buffer that is actually there.

The case worth naming is a buffer index equal to the number of buffers, for the same reason as the dictionary key: it is the value an off by one produces and it is in range for everything except the thing it indexes.

ยงErrors

Returns a violation of Invariant::ViewBuffer for a view pointing at a buffer that is not there or past the end of one that is, and of Invariant::BufferLength if the views buffer is not a whole number of views or is short.