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

Method get

crates/vm/src/types/slot.rs:40–46  ·  view source on GitHub ↗

Get a reference to the data if the type matches.

(&self)

Source from the content-addressed store, hash-verified

38
39 /// Get a reference to the data if the type matches.
40 pub fn get<T: Any + 'static>(&self) -> Option<&T> {
41 if self.type_id == TypeId::of::<T>() {
42 self.data.downcast_ref()
43 } else {
44 None
45 }
46 }
47
48 /// Get a mutable reference to the data if the type matches.
49 pub fn get_mut<T: Any + 'static>(&mut self) -> Option<&mut T> {

Callers 2

update_one_slotMethod · 0.45
lookup_slot_in_mroMethod · 0.45

Calls 1

downcast_refMethod · 0.80

Tested by

no test coverage detected