MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / from_slice

Function from_slice

cranelift/entity/src/list.rs:718–734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

716
717 #[test]
718 fn from_slice() {
719 let pool = &mut ListPool::<Inst>::new();
720
721 let list = EntityList::<Inst>::from_slice(&[Inst(0), Inst(1)], pool);
722 assert!(!list.is_empty());
723 assert_eq!(list.len(pool), 2);
724 assert_eq!(list.as_slice(pool), &[Inst(0), Inst(1)]);
725 assert_eq!(list.get(0, pool), Some(Inst(0)));
726 assert_eq!(list.get(100, pool), None);
727
728 let list = EntityList::<Inst>::from_slice(&[], pool);
729 assert!(list.is_empty());
730 assert_eq!(list.len(pool), 0);
731 assert_eq!(list.as_slice(pool), &[]);
732 assert_eq!(list.get(0, pool), None);
733 assert_eq!(list.get(100, pool), None);
734 }
735
736 #[test]
737 fn push() {

Callers 10

dumpFunction · 0.85
from_sliceMethod · 0.85
deep_cloneFunction · 0.85
truncateFunction · 0.85
copy_fromFunction · 0.85
copy_from_selfFunction · 0.85
fromMethod · 0.85
exec_fd_readdirFunction · 0.85
test_fd_readdir_past_endFunction · 0.85

Calls 2

InstClass · 0.70
newFunction · 0.50

Tested by

no test coverage detected