Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
//! Storage area.
use super::{cow_slice::CowSlice, error::HintErrorKind};
/// Backing store for the storage area.
///
/// This is just a wrapper for [`CowSlice`] that converts out of bounds
/// accesses to appropriate errors.
pub struct Storage<'a>(CowSlice<'a>);
impl Storage<'_> {
pub fn get(&self, index: usize) -> Result<i32, HintErrorKind> {
self.0
.get(index)
.ok_or(HintErrorKind::InvalidStorageIndex(index))
}
pub fn set(&mut self, index: usize, value: i32) -> Result<(), HintErrorKind> {
self.0
.set(index, value)
.ok_or(HintErrorKind::InvalidStorageIndex(index))
}
}
impl<'a> From<CowSlice<'a>> for Storage<'a> {
fn from(value: CowSlice<'a>) -> Self {
Self(value)
}
}