Skip to main content

ast_node_as

Function ast_node_as 

Source
pub unsafe fn ast_node_as<T>(node: *mut AstNode) -> *mut T
where T: AstNodeClass,
Expand description

node->as<T>() โ€” downcast a base-node pointer to *mut T, or null when the dynamic type does not match.

ยงSafety

node must be null or point to a live node whose first field is (transitively) an AstNode โ€” i.e. any of the generated #[repr(C)] node structs. This is the same precondition as the C++ static_cast<T*>(this) it replaces.