MCPcopy Index your code
hub / github.com/RustPython/RustPython / try_ref

Method try_ref

crates/vm/src/stdlib/marshal.rs:136–146  ·  view source on GitHub ↗
(&mut self, buf: &mut Vec<u8>, obj: &PyObjectRef)

Source from the content-addressed store, hash-verified

134 }
135 }
136 fn try_ref(&mut self, buf: &mut Vec<u8>, obj: &PyObjectRef) -> bool {
137 use marshal::Write;
138 let id = obj.get_id();
139 if let Some(&idx) = self.map.get(&id) {
140 buf.write_u8(b'r');
141 buf.write_u32(idx);
142 true
143 } else {
144 false
145 }
146 }
147 fn reserve(&mut self, obj: &PyObjectRef) -> u32 {
148 let idx = self.next_idx;
149 self.map.insert(obj.get_id(), idx);

Callers 1

write_object_depthFunction · 0.80

Calls 4

write_u8Method · 0.80
write_u32Method · 0.80
get_idMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected