1c4be2d84SNick Fitzgerald use crate::{ 2a727985cSAlex Crichton ArrayType, AsContext, AsContextMut, GcRefImpl, Result, Val, 3*90ac295eSAlex Crichton store::{StoreContextMut, StoreOpaque}, 4c4be2d84SNick Fitzgerald }; 5c4be2d84SNick Fitzgerald 6c4be2d84SNick Fitzgerald /// Support for `ArrayRefPre` disabled at compile time because the `gc` cargo 7c4be2d84SNick Fitzgerald /// feature was not enabled. 8c4be2d84SNick Fitzgerald pub enum ArrayRefPre {} 9c4be2d84SNick Fitzgerald 10c4be2d84SNick Fitzgerald /// Support for `arrayref` disabled at compile time because the `gc` cargo feature 11c4be2d84SNick Fitzgerald /// was not enabled. 12c4be2d84SNick Fitzgerald pub enum ArrayRef {} 13c4be2d84SNick Fitzgerald 14c4be2d84SNick Fitzgerald impl GcRefImpl for ArrayRef {} 15c4be2d84SNick Fitzgerald 16c4be2d84SNick Fitzgerald impl ArrayRef { ty(&self, _store: impl AsContext) -> Result<ArrayType>17c4be2d84SNick Fitzgerald pub fn ty(&self, _store: impl AsContext) -> Result<ArrayType> { 18c4be2d84SNick Fitzgerald match *self {} 19c4be2d84SNick Fitzgerald } 20c4be2d84SNick Fitzgerald matches_ty(&self, _store: impl AsContext, _ty: &ArrayType) -> Result<bool>21c4be2d84SNick Fitzgerald pub fn matches_ty(&self, _store: impl AsContext, _ty: &ArrayType) -> Result<bool> { 22c4be2d84SNick Fitzgerald match *self {} 23c4be2d84SNick Fitzgerald } 24c4be2d84SNick Fitzgerald _matches_ty(&self, _store: &StoreOpaque, _ty: &ArrayType) -> Result<bool>25c4be2d84SNick Fitzgerald pub(crate) fn _matches_ty(&self, _store: &StoreOpaque, _ty: &ArrayType) -> Result<bool> { 26c4be2d84SNick Fitzgerald match *self {} 27c4be2d84SNick Fitzgerald } 28c4be2d84SNick Fitzgerald len(&self, _store: impl AsContext) -> Result<u32>29c4be2d84SNick Fitzgerald pub fn len(&self, _store: impl AsContext) -> Result<u32> { 30c4be2d84SNick Fitzgerald match *self {} 31c4be2d84SNick Fitzgerald } 32c4be2d84SNick Fitzgerald elems<'a, T: 'static>( &self, _store: impl Into<StoreContextMut<'a, T>>, ) -> Result<impl ExactSizeIterator<Item = Val> + 'a + '_>33f81c0dc0SAlex Crichton pub fn elems<'a, T: 'static>( 34c4be2d84SNick Fitzgerald &self, 35c4be2d84SNick Fitzgerald _store: impl Into<StoreContextMut<'a, T>>, 36de1ad347SAlex Crichton ) -> Result<impl ExactSizeIterator<Item = Val> + 'a + '_> { 37c4be2d84SNick Fitzgerald match *self {} 38c4be2d84SNick Fitzgerald Ok([].into_iter()) 39c4be2d84SNick Fitzgerald } 40c4be2d84SNick Fitzgerald get(&self, _store: impl AsContextMut, _index: usize) -> Result<Val>41c4be2d84SNick Fitzgerald pub fn get(&self, _store: impl AsContextMut, _index: usize) -> Result<Val> { 42c4be2d84SNick Fitzgerald match *self {} 43c4be2d84SNick Fitzgerald } 44c4be2d84SNick Fitzgerald set(&self, _store: impl AsContextMut, _index: usize, _value: Val) -> Result<()>45c4be2d84SNick Fitzgerald pub fn set(&self, _store: impl AsContextMut, _index: usize, _value: Val) -> Result<()> { 46c4be2d84SNick Fitzgerald match *self {} 47c4be2d84SNick Fitzgerald } 48c4be2d84SNick Fitzgerald } 49