pub fn validate<'a, T: FromBytes<'a>>(store: &[u64]) -> Result<(), String>Expand description
Validates that store contains well-formed data compatible with type T.
Checks both the internal structure of the encoding (offsets, slice count) and type-level compatibility (each slice’s byte length is a multiple of its element size). Call this once at trust boundaries when receiving encoded data.
The from_store decode path performs no further validation at access time:
it will not panic on malformed data, but may return incorrect results.
There is no undefined behavior in any case. Call this method once before
using from_store to ensure the data is well-formed.
ⓘ
type B<'a> = <MyContainer as Borrow>::Borrowed<'a>;
indexed::validate::<B>(&store)?;
// Now safe to use the non-panicking path:
let ds = indexed::DecodedStore::new(&store);
let borrowed = B::from_store(&ds, &mut 0);