Function pyo3_macros_backend::attributes::take_attributes

source ·
pub fn take_attributes(
    attrs: &mut Vec<Attribute>,
    extractor: impl FnMut(&Attribute) -> Result<bool>
) -> Result<()>
Expand description

Takes attributes from an attribute vector.

For each attribute in attrs, extractor is called. If extractor returns Ok(true), then the attribute will be removed from the vector.

This is similar to Vec::retain except the closure is fallible and the condition is reversed. (In retain, returning true keeps the element, here it removes it.)

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here