fn validate_memory(&self, ty: &MemoryType) -> Result<(), MemoryError> {
        if ty.minimum > self.limit {
            return Err(MemoryError::Generic(
                "Minimum exceeds the allowed memory limit".to_string(),
            ));
        }

        if let Some(max) = ty.maximum {
            if max > self.limit {
                return Err(MemoryError::Generic(
                    "Maximum exceeds the allowed memory limit".to_string(),
                ));
            }
        } else {
            return Err(MemoryError::Generic("Maximum unset".to_string()));
        }

        Ok(())
    }
/// Ensures the a given memory type does not exceed the memory limit.
/// Call this after adjusting the memory.
Ensures the a given memory type does not exceed the memory limit.
Call this after adjusting the memory.
Ensures the a given memory type does not exceed the memory limit . Call this after adjusting the memory .
fn validate_memory(&self, ty: &MemoryType) -> Result<(), MemoryError> {
        if ty.minimum > self.limit {
            return Err(MemoryError::Generic(
                "Minimum exceeds the allowed memory limit".to_string(),
            ));
        }
        if let Some(max) = ty.maximum {
            if max > self.limit {
                return Err(MemoryError::Generic(
                    "Maximum exceeds the allowed memory limit".to_string(),
                ));
            }
        } else {
            return Err(MemoryError::Generic("Maximum unset".to_string()));
        }
        Ok(())
    }
fn validate_memory ( & self , ty : & MemoryType ) -> Result < ( ) , MemoryError > { if ty . minimum > self . limit { return Err ( MemoryError :: Generic ( " " . to_string ( ) , ) ) ; } if let Some ( max ) = ty . maximum { if max > self . limit { return Err ( MemoryError :: Generic ( " " . to_string ( ) , ) ) ; } } else { return Err ( MemoryError :: Generic ( " " . to_string ( ) ) ) ; } Ok ( ( ) ) }
Ensures the a given memory type does not exceed the memory limit.
Ensures the a given memory type does not exceed the memory limit .
&self
ty
&MemoryType
&self
ty
&MemoryType