MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / len

Method len

flow-message/src/cross/data/mod.rs:110–120  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

108 }
109
110 pub fn len(&self) -> usize {
111 match self.ty {
112 DataType::Value(_) => 1usize,
113 DataType::Collection(CollectionType::List(value_ty)) => {
114 self.data.as_bytes().unwrap().len() / value_ty.width()
115 }
116 DataType::Collection(CollectionType::Map) => self.data.as_ref().unwrap().len(),
117 DataType::Collection(CollectionType::CowList) => self.data.as_datas().unwrap().len(),
118 DataType::Collection(CollectionType::CowMap) => self.data.as_cow_ref().unwrap().len(),
119 }
120 }
121
122 pub fn is_empty(&self) -> bool {
123 self.len() == 0

Callers 10

__len__Method · 0.45
__len__Method · 0.45
__setitem__Method · 0.45
__getitem__Method · 0.45
__delitem__Method · 0.45
__len__Method · 0.45
__setitem__Method · 0.45
__getitem__Method · 0.45
__len__Method · 0.45
is_emptyMethod · 0.45

Calls 2

widthMethod · 0.80
as_refMethod · 0.80

Tested by

no test coverage detected