use oxmera_core::{DType, Device};
#[derive(Debug)]
pub struct Storage {
data: StorageData,
dtype: DType,
device: Device,
}
#[derive(Debug)]
enum StorageData {
#[expect(dead_code, reason = "constructed once exercise A1 is solved")]
Cpu(Vec<u8>),
}
impl Storage {
pub fn cpu_zeros(numel: usize, dtype: DType) -> Self {
let _ = (numel, dtype);
todo!("exercise A1: shape and strides")
}
pub fn cpu_from_bytes(bytes: Vec<u8>, dtype: DType) -> Self {
let _ = (bytes, dtype);
todo!("exercise A1: shape and strides")
}
pub fn dtype(&self) -> DType {
self.dtype
}
pub fn device(&self) -> Device {
self.device
}
pub fn cpu_bytes(&self) -> Option<&[u8]> {
match &self.data {
StorageData::Cpu(bytes) => Some(bytes),
}
}
}